Line data Source code
1 : /*
2 : * DO NOT EDIT. THIS FILE IS GENERATED FROM ../../../dist/idl/nsIBinaryInputStream.idl
3 : */
4 :
5 : #ifndef __gen_nsIBinaryInputStream_h__
6 : #define __gen_nsIBinaryInputStream_h__
7 :
8 :
9 : #ifndef __gen_nsIInputStream_h__
10 : #include "nsIInputStream.h"
11 : #endif
12 :
13 : #include "js/Value.h"
14 :
15 : /* For IDL files that don't want to include root IDL files. */
16 : #ifndef NS_NO_VTABLE
17 : #define NS_NO_VTABLE
18 : #endif
19 :
20 : /* starting interface: nsIBinaryInputStream */
21 : #define NS_IBINARYINPUTSTREAM_IID_STR "899b826b-2eb3-469c-8b31-4c29f5d341a6"
22 :
23 : #define NS_IBINARYINPUTSTREAM_IID \
24 : {0x899b826b, 0x2eb3, 0x469c, \
25 : { 0x8b, 0x31, 0x4c, 0x29, 0xf5, 0xd3, 0x41, 0xa6 }}
26 :
27 76 : class NS_NO_VTABLE nsIBinaryInputStream : public nsIInputStream {
28 : public:
29 :
30 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_IBINARYINPUTSTREAM_IID)
31 :
32 : /* void setInputStream (in nsIInputStream aInputStream); */
33 : NS_IMETHOD SetInputStream(nsIInputStream *aInputStream) = 0;
34 :
35 : /* boolean readBoolean (); */
36 : NS_IMETHOD ReadBoolean(bool *_retval) = 0;
37 :
38 : /* uint8_t read8 (); */
39 : NS_IMETHOD Read8(uint8_t *_retval) = 0;
40 :
41 : /* uint16_t read16 (); */
42 : NS_IMETHOD Read16(uint16_t *_retval) = 0;
43 :
44 : /* uint32_t read32 (); */
45 : NS_IMETHOD Read32(uint32_t *_retval) = 0;
46 :
47 : /* uint64_t read64 (); */
48 : NS_IMETHOD Read64(uint64_t *_retval) = 0;
49 :
50 : /* float readFloat (); */
51 : NS_IMETHOD ReadFloat(float *_retval) = 0;
52 :
53 : /* double readDouble (); */
54 : NS_IMETHOD ReadDouble(double *_retval) = 0;
55 :
56 : /* ACString readCString (); */
57 : NS_IMETHOD ReadCString(nsACString & _retval) = 0;
58 :
59 : /* AString readString (); */
60 : NS_IMETHOD ReadString(nsAString & _retval) = 0;
61 :
62 : /* void readBytes (in uint32_t aLength, [size_is (aLength), retval] out string aString); */
63 : NS_IMETHOD ReadBytes(uint32_t aLength, char * *aString) = 0;
64 :
65 : /* void readByteArray (in uint32_t aLength, [array, size_is (aLength), retval] out uint8_t aBytes); */
66 : NS_IMETHOD ReadByteArray(uint32_t aLength, uint8_t **aBytes) = 0;
67 :
68 : /* [implicit_jscontext] unsigned long readArrayBuffer (in uint32_t aLength, in jsval aArrayBuffer); */
69 : NS_IMETHOD ReadArrayBuffer(uint32_t aLength, JS::HandleValue aArrayBuffer, JSContext* cx, uint32_t *_retval) = 0;
70 :
71 : };
72 :
73 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIBinaryInputStream, NS_IBINARYINPUTSTREAM_IID)
74 :
75 : /* Use this macro when declaring classes that implement this interface. */
76 : #define NS_DECL_NSIBINARYINPUTSTREAM \
77 : NS_IMETHOD SetInputStream(nsIInputStream *aInputStream) override; \
78 : NS_IMETHOD ReadBoolean(bool *_retval) override; \
79 : NS_IMETHOD Read8(uint8_t *_retval) override; \
80 : NS_IMETHOD Read16(uint16_t *_retval) override; \
81 : NS_IMETHOD Read32(uint32_t *_retval) override; \
82 : NS_IMETHOD Read64(uint64_t *_retval) override; \
83 : NS_IMETHOD ReadFloat(float *_retval) override; \
84 : NS_IMETHOD ReadDouble(double *_retval) override; \
85 : NS_IMETHOD ReadCString(nsACString & _retval) override; \
86 : NS_IMETHOD ReadString(nsAString & _retval) override; \
87 : NS_IMETHOD ReadBytes(uint32_t aLength, char * *aString) override; \
88 : NS_IMETHOD ReadByteArray(uint32_t aLength, uint8_t **aBytes) override; \
89 : NS_IMETHOD ReadArrayBuffer(uint32_t aLength, JS::HandleValue aArrayBuffer, JSContext* cx, uint32_t *_retval) override;
90 :
91 : /* Use this macro when declaring the members of this interface when the
92 : class doesn't implement the interface. This is useful for forwarding. */
93 : #define NS_DECL_NON_VIRTUAL_NSIBINARYINPUTSTREAM \
94 : nsresult SetInputStream(nsIInputStream *aInputStream); \
95 : nsresult ReadBoolean(bool *_retval); \
96 : nsresult Read8(uint8_t *_retval); \
97 : nsresult Read16(uint16_t *_retval); \
98 : nsresult Read32(uint32_t *_retval); \
99 : nsresult Read64(uint64_t *_retval); \
100 : nsresult ReadFloat(float *_retval); \
101 : nsresult ReadDouble(double *_retval); \
102 : nsresult ReadCString(nsACString & _retval); \
103 : nsresult ReadString(nsAString & _retval); \
104 : nsresult ReadBytes(uint32_t aLength, char * *aString); \
105 : nsresult ReadByteArray(uint32_t aLength, uint8_t **aBytes); \
106 : nsresult ReadArrayBuffer(uint32_t aLength, JS::HandleValue aArrayBuffer, JSContext* cx, uint32_t *_retval);
107 :
108 : /* Use this macro to declare functions that forward the behavior of this interface to another object. */
109 : #define NS_FORWARD_NSIBINARYINPUTSTREAM(_to) \
110 : NS_IMETHOD SetInputStream(nsIInputStream *aInputStream) override { return _to SetInputStream(aInputStream); } \
111 : NS_IMETHOD ReadBoolean(bool *_retval) override { return _to ReadBoolean(_retval); } \
112 : NS_IMETHOD Read8(uint8_t *_retval) override { return _to Read8(_retval); } \
113 : NS_IMETHOD Read16(uint16_t *_retval) override { return _to Read16(_retval); } \
114 : NS_IMETHOD Read32(uint32_t *_retval) override { return _to Read32(_retval); } \
115 : NS_IMETHOD Read64(uint64_t *_retval) override { return _to Read64(_retval); } \
116 : NS_IMETHOD ReadFloat(float *_retval) override { return _to ReadFloat(_retval); } \
117 : NS_IMETHOD ReadDouble(double *_retval) override { return _to ReadDouble(_retval); } \
118 : NS_IMETHOD ReadCString(nsACString & _retval) override { return _to ReadCString(_retval); } \
119 : NS_IMETHOD ReadString(nsAString & _retval) override { return _to ReadString(_retval); } \
120 : NS_IMETHOD ReadBytes(uint32_t aLength, char * *aString) override { return _to ReadBytes(aLength, aString); } \
121 : NS_IMETHOD ReadByteArray(uint32_t aLength, uint8_t **aBytes) override { return _to ReadByteArray(aLength, aBytes); } \
122 : NS_IMETHOD ReadArrayBuffer(uint32_t aLength, JS::HandleValue aArrayBuffer, JSContext* cx, uint32_t *_retval) override { return _to ReadArrayBuffer(aLength, aArrayBuffer, cx, _retval); }
123 :
124 : /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
125 : #define NS_FORWARD_SAFE_NSIBINARYINPUTSTREAM(_to) \
126 : NS_IMETHOD SetInputStream(nsIInputStream *aInputStream) override { return !_to ? NS_ERROR_NULL_POINTER : _to->SetInputStream(aInputStream); } \
127 : NS_IMETHOD ReadBoolean(bool *_retval) override { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadBoolean(_retval); } \
128 : NS_IMETHOD Read8(uint8_t *_retval) override { return !_to ? NS_ERROR_NULL_POINTER : _to->Read8(_retval); } \
129 : NS_IMETHOD Read16(uint16_t *_retval) override { return !_to ? NS_ERROR_NULL_POINTER : _to->Read16(_retval); } \
130 : NS_IMETHOD Read32(uint32_t *_retval) override { return !_to ? NS_ERROR_NULL_POINTER : _to->Read32(_retval); } \
131 : NS_IMETHOD Read64(uint64_t *_retval) override { return !_to ? NS_ERROR_NULL_POINTER : _to->Read64(_retval); } \
132 : NS_IMETHOD ReadFloat(float *_retval) override { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadFloat(_retval); } \
133 : NS_IMETHOD ReadDouble(double *_retval) override { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadDouble(_retval); } \
134 : NS_IMETHOD ReadCString(nsACString & _retval) override { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadCString(_retval); } \
135 : NS_IMETHOD ReadString(nsAString & _retval) override { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadString(_retval); } \
136 : NS_IMETHOD ReadBytes(uint32_t aLength, char * *aString) override { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadBytes(aLength, aString); } \
137 : NS_IMETHOD ReadByteArray(uint32_t aLength, uint8_t **aBytes) override { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadByteArray(aLength, aBytes); } \
138 : NS_IMETHOD ReadArrayBuffer(uint32_t aLength, JS::HandleValue aArrayBuffer, JSContext* cx, uint32_t *_retval) override { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadArrayBuffer(aLength, aArrayBuffer, cx, _retval); }
139 :
140 : #if 0
141 : /* Use the code below as a template for the implementation class for this interface. */
142 :
143 : /* Header file */
144 : class nsBinaryInputStream : public nsIBinaryInputStream
145 : {
146 : public:
147 : NS_DECL_ISUPPORTS
148 : NS_DECL_NSIBINARYINPUTSTREAM
149 :
150 : nsBinaryInputStream();
151 :
152 : private:
153 : ~nsBinaryInputStream();
154 :
155 : protected:
156 : /* additional members */
157 : };
158 :
159 : /* Implementation file */
160 : NS_IMPL_ISUPPORTS(nsBinaryInputStream, nsIBinaryInputStream)
161 :
162 : nsBinaryInputStream::nsBinaryInputStream()
163 : {
164 : /* member initializers and constructor code */
165 : }
166 :
167 : nsBinaryInputStream::~nsBinaryInputStream()
168 : {
169 : /* destructor code */
170 : }
171 :
172 : /* void setInputStream (in nsIInputStream aInputStream); */
173 : NS_IMETHODIMP nsBinaryInputStream::SetInputStream(nsIInputStream *aInputStream)
174 : {
175 : return NS_ERROR_NOT_IMPLEMENTED;
176 : }
177 :
178 : /* boolean readBoolean (); */
179 : NS_IMETHODIMP nsBinaryInputStream::ReadBoolean(bool *_retval)
180 : {
181 : return NS_ERROR_NOT_IMPLEMENTED;
182 : }
183 :
184 : /* uint8_t read8 (); */
185 : NS_IMETHODIMP nsBinaryInputStream::Read8(uint8_t *_retval)
186 : {
187 : return NS_ERROR_NOT_IMPLEMENTED;
188 : }
189 :
190 : /* uint16_t read16 (); */
191 : NS_IMETHODIMP nsBinaryInputStream::Read16(uint16_t *_retval)
192 : {
193 : return NS_ERROR_NOT_IMPLEMENTED;
194 : }
195 :
196 : /* uint32_t read32 (); */
197 : NS_IMETHODIMP nsBinaryInputStream::Read32(uint32_t *_retval)
198 : {
199 : return NS_ERROR_NOT_IMPLEMENTED;
200 : }
201 :
202 : /* uint64_t read64 (); */
203 : NS_IMETHODIMP nsBinaryInputStream::Read64(uint64_t *_retval)
204 : {
205 : return NS_ERROR_NOT_IMPLEMENTED;
206 : }
207 :
208 : /* float readFloat (); */
209 : NS_IMETHODIMP nsBinaryInputStream::ReadFloat(float *_retval)
210 : {
211 : return NS_ERROR_NOT_IMPLEMENTED;
212 : }
213 :
214 : /* double readDouble (); */
215 : NS_IMETHODIMP nsBinaryInputStream::ReadDouble(double *_retval)
216 : {
217 : return NS_ERROR_NOT_IMPLEMENTED;
218 : }
219 :
220 : /* ACString readCString (); */
221 : NS_IMETHODIMP nsBinaryInputStream::ReadCString(nsACString & _retval)
222 : {
223 : return NS_ERROR_NOT_IMPLEMENTED;
224 : }
225 :
226 : /* AString readString (); */
227 : NS_IMETHODIMP nsBinaryInputStream::ReadString(nsAString & _retval)
228 : {
229 : return NS_ERROR_NOT_IMPLEMENTED;
230 : }
231 :
232 : /* void readBytes (in uint32_t aLength, [size_is (aLength), retval] out string aString); */
233 : NS_IMETHODIMP nsBinaryInputStream::ReadBytes(uint32_t aLength, char * *aString)
234 : {
235 : return NS_ERROR_NOT_IMPLEMENTED;
236 : }
237 :
238 : /* void readByteArray (in uint32_t aLength, [array, size_is (aLength), retval] out uint8_t aBytes); */
239 : NS_IMETHODIMP nsBinaryInputStream::ReadByteArray(uint32_t aLength, uint8_t **aBytes)
240 : {
241 : return NS_ERROR_NOT_IMPLEMENTED;
242 : }
243 :
244 : /* [implicit_jscontext] unsigned long readArrayBuffer (in uint32_t aLength, in jsval aArrayBuffer); */
245 : NS_IMETHODIMP nsBinaryInputStream::ReadArrayBuffer(uint32_t aLength, JS::HandleValue aArrayBuffer, JSContext* cx, uint32_t *_retval)
246 : {
247 : return NS_ERROR_NOT_IMPLEMENTED;
248 : }
249 :
250 : /* End of implementation class template. */
251 : #endif
252 :
253 :
254 : #ifdef MOZILLA_INTERNAL_API
255 : #include "nsString.h"
256 : inline nsresult
257 90 : NS_ReadOptionalCString(nsIBinaryInputStream* aStream, nsACString& aResult)
258 : {
259 : bool nonnull;
260 90 : nsresult rv = aStream->ReadBoolean(&nonnull);
261 90 : if (NS_SUCCEEDED(rv)) {
262 90 : if (nonnull)
263 90 : rv = aStream->ReadCString(aResult);
264 : else
265 0 : aResult.Truncate();
266 : }
267 90 : return rv;
268 : }
269 : inline nsresult
270 : NS_ReadOptionalString(nsIBinaryInputStream* aStream, nsAString& aResult)
271 : {
272 : bool nonnull;
273 : nsresult rv = aStream->ReadBoolean(&nonnull);
274 : if (NS_SUCCEEDED(rv)) {
275 : if (nonnull)
276 : rv = aStream->ReadString(aResult);
277 : else
278 : aResult.Truncate();
279 : }
280 : return rv;
281 : }
282 : #endif
283 :
284 : #endif /* __gen_nsIBinaryInputStream_h__ */
|