PageRenderTime 119ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/gecko_api/include/nsIUploadChannel.h

http://firefox-mac-pdf.googlecode.com/
C Header | 145 lines | 57 code | 29 blank | 59 comment | 0 complexity | 915b2106242eb9bfb7e01fdba831b2ba MD5 | raw file
  1. /*
  2. * DO NOT EDIT. THIS FILE IS GENERATED FROM /builds/tinderbox/XR-Trunk/Darwin_8.8.4_Depend/mozilla/netwerk/base/public/nsIUploadChannel.idl
  3. */
  4. #ifndef __gen_nsIUploadChannel_h__
  5. #define __gen_nsIUploadChannel_h__
  6. #ifndef __gen_nsISupports_h__
  7. #include "nsISupports.h"
  8. #endif
  9. /* For IDL files that don't want to include root IDL files. */
  10. #ifndef NS_NO_VTABLE
  11. #define NS_NO_VTABLE
  12. #endif
  13. class nsIInputStream; /* forward declaration */
  14. /* starting interface: nsIUploadChannel */
  15. #define NS_IUPLOADCHANNEL_IID_STR "ddf633d8-e9a4-439d-ad88-de636fd9bb75"
  16. #define NS_IUPLOADCHANNEL_IID \
  17. {0xddf633d8, 0xe9a4, 0x439d, \
  18. { 0xad, 0x88, 0xde, 0x63, 0x6f, 0xd9, 0xbb, 0x75 }}
  19. /**
  20. * nsIUploadChannel
  21. *
  22. * A channel may optionally implement this interface if it supports the
  23. * notion of uploading a data stream. The upload stream may only be set
  24. * prior to the invocation of asyncOpen on the channel.
  25. *
  26. * @status FROZEN
  27. */
  28. class NS_NO_VTABLE NS_SCRIPTABLE nsIUploadChannel : public nsISupports {
  29. public:
  30. NS_DECLARE_STATIC_IID_ACCESSOR(NS_IUPLOADCHANNEL_IID)
  31. /**
  32. * Sets a stream to be uploaded by this channel.
  33. *
  34. * Most implementations of this interface require that the stream:
  35. * (1) implement threadsafe addRef and release
  36. * (2) implement nsIInputStream::readSegments
  37. * (3) implement nsISeekableStream::seek
  38. *
  39. * History here is that we need to support both streams that already have
  40. * headers (e.g., Content-Type and Content-Length) information prepended to
  41. * the stream (by plugins) as well as clients (composer, uploading
  42. * application) that want to upload data streams without any knowledge of
  43. * protocol specifications. For this reason, we have a special meaning
  44. * for the aContentType parameter (see below).
  45. *
  46. * @param aStream
  47. * The stream to be uploaded by this channel.
  48. * @param aContentType
  49. * If aContentType is empty, the protocol will assume that no
  50. * content headers are to be added to the uploaded stream and that
  51. * any required headers are already encoded in the stream. In the
  52. * case of HTTP, if this parameter is non-empty, then its value will
  53. * replace any existing Content-Type header on the HTTP request.
  54. * In the case of FTP and FILE, this parameter is ignored.
  55. * @param aContentLength
  56. * A value of -1 indicates that the length of the stream should be
  57. * determined by calling the stream's |available| method.
  58. */
  59. /* void setUploadStream (in nsIInputStream aStream, in ACString aContentType, in long aContentLength); */
  60. NS_SCRIPTABLE NS_IMETHOD SetUploadStream(nsIInputStream *aStream, const nsACString & aContentType, PRInt32 aContentLength) = 0;
  61. /**
  62. * Get the stream (to be) uploaded by this channel.
  63. */
  64. /* readonly attribute nsIInputStream uploadStream; */
  65. NS_SCRIPTABLE NS_IMETHOD GetUploadStream(nsIInputStream * *aUploadStream) = 0;
  66. };
  67. NS_DEFINE_STATIC_IID_ACCESSOR(nsIUploadChannel, NS_IUPLOADCHANNEL_IID)
  68. /* Use this macro when declaring classes that implement this interface. */
  69. #define NS_DECL_NSIUPLOADCHANNEL \
  70. NS_SCRIPTABLE NS_IMETHOD SetUploadStream(nsIInputStream *aStream, const nsACString & aContentType, PRInt32 aContentLength); \
  71. NS_SCRIPTABLE NS_IMETHOD GetUploadStream(nsIInputStream * *aUploadStream);
  72. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  73. #define NS_FORWARD_NSIUPLOADCHANNEL(_to) \
  74. NS_SCRIPTABLE NS_IMETHOD SetUploadStream(nsIInputStream *aStream, const nsACString & aContentType, PRInt32 aContentLength) { return _to SetUploadStream(aStream, aContentType, aContentLength); } \
  75. NS_SCRIPTABLE NS_IMETHOD GetUploadStream(nsIInputStream * *aUploadStream) { return _to GetUploadStream(aUploadStream); }
  76. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  77. #define NS_FORWARD_SAFE_NSIUPLOADCHANNEL(_to) \
  78. NS_SCRIPTABLE NS_IMETHOD SetUploadStream(nsIInputStream *aStream, const nsACString & aContentType, PRInt32 aContentLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetUploadStream(aStream, aContentType, aContentLength); } \
  79. NS_SCRIPTABLE NS_IMETHOD GetUploadStream(nsIInputStream * *aUploadStream) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetUploadStream(aUploadStream); }
  80. #if 0
  81. /* Use the code below as a template for the implementation class for this interface. */
  82. /* Header file */
  83. class nsUploadChannel : public nsIUploadChannel
  84. {
  85. public:
  86. NS_DECL_ISUPPORTS
  87. NS_DECL_NSIUPLOADCHANNEL
  88. nsUploadChannel();
  89. private:
  90. ~nsUploadChannel();
  91. protected:
  92. /* additional members */
  93. };
  94. /* Implementation file */
  95. NS_IMPL_ISUPPORTS1(nsUploadChannel, nsIUploadChannel)
  96. nsUploadChannel::nsUploadChannel()
  97. {
  98. /* member initializers and constructor code */
  99. }
  100. nsUploadChannel::~nsUploadChannel()
  101. {
  102. /* destructor code */
  103. }
  104. /* void setUploadStream (in nsIInputStream aStream, in ACString aContentType, in long aContentLength); */
  105. NS_IMETHODIMP nsUploadChannel::SetUploadStream(nsIInputStream *aStream, const nsACString & aContentType, PRInt32 aContentLength)
  106. {
  107. return NS_ERROR_NOT_IMPLEMENTED;
  108. }
  109. /* readonly attribute nsIInputStream uploadStream; */
  110. NS_IMETHODIMP nsUploadChannel::GetUploadStream(nsIInputStream * *aUploadStream)
  111. {
  112. return NS_ERROR_NOT_IMPLEMENTED;
  113. }
  114. /* End of implementation class template. */
  115. #endif
  116. #endif /* __gen_nsIUploadChannel_h__ */