1 : /*
2 : * DO NOT EDIT. THIS FILE IS GENERATED FROM /builds/slave/m-beta-lnx-codecoverage/build/xpcom/io/nsIStreamBufferAccess.idl
3 : */
4 :
5 : #ifndef __gen_nsIStreamBufferAccess_h__
6 : #define __gen_nsIStreamBufferAccess_h__
7 :
8 :
9 : #ifndef __gen_nsISupports_h__
10 : #include "nsISupports.h"
11 : #endif
12 :
13 : #ifndef __gen_nsrootidl_h__
14 : #include "nsrootidl.h"
15 : #endif
16 :
17 : /* For IDL files that don't want to include root IDL files. */
18 : #ifndef NS_NO_VTABLE
19 : #define NS_NO_VTABLE
20 : #endif
21 :
22 : /* starting interface: nsIStreamBufferAccess */
23 : #define NS_ISTREAMBUFFERACCESS_IID_STR "ac923b72-ac87-4892-ac7a-ca385d429435"
24 :
25 : #define NS_ISTREAMBUFFERACCESS_IID \
26 : {0xac923b72, 0xac87, 0x4892, \
27 : { 0xac, 0x7a, 0xca, 0x38, 0x5d, 0x42, 0x94, 0x35 }}
28 :
29 3919 : class NS_NO_VTABLE NS_SCRIPTABLE nsIStreamBufferAccess : public nsISupports {
30 : public:
31 :
32 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISTREAMBUFFERACCESS_IID)
33 :
34 : /* [noscript,notxpcom] charPtr getBuffer (in PRUint32 aLength, in PRUint32 aAlignMask); */
35 : NS_IMETHOD_(char *) GetBuffer(PRUint32 aLength, PRUint32 aAlignMask) = 0;
36 :
37 : /* [noscript,notxpcom] void putBuffer (in charPtr aBuffer, in PRUint32 aLength); */
38 : NS_IMETHOD_(void) PutBuffer(char *aBuffer, PRUint32 aLength) = 0;
39 :
40 : /* void disableBuffering (); */
41 : NS_SCRIPTABLE NS_IMETHOD DisableBuffering(void) = 0;
42 :
43 : /* void enableBuffering (); */
44 : NS_SCRIPTABLE NS_IMETHOD EnableBuffering(void) = 0;
45 :
46 : /* readonly attribute nsISupports unbufferedStream; */
47 : NS_SCRIPTABLE NS_IMETHOD GetUnbufferedStream(nsISupports * *aUnbufferedStream) = 0;
48 :
49 : };
50 :
51 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIStreamBufferAccess, NS_ISTREAMBUFFERACCESS_IID)
52 :
53 : /* Use this macro when declaring classes that implement this interface. */
54 : #define NS_DECL_NSISTREAMBUFFERACCESS \
55 : NS_IMETHOD_(char *) GetBuffer(PRUint32 aLength, PRUint32 aAlignMask); \
56 : NS_IMETHOD_(void) PutBuffer(char *aBuffer, PRUint32 aLength); \
57 : NS_SCRIPTABLE NS_IMETHOD DisableBuffering(void); \
58 : NS_SCRIPTABLE NS_IMETHOD EnableBuffering(void); \
59 : NS_SCRIPTABLE NS_IMETHOD GetUnbufferedStream(nsISupports * *aUnbufferedStream);
60 :
61 : /* Use this macro to declare functions that forward the behavior of this interface to another object. */
62 : #define NS_FORWARD_NSISTREAMBUFFERACCESS(_to) \
63 : NS_IMETHOD_(char *) GetBuffer(PRUint32 aLength, PRUint32 aAlignMask) { return _to GetBuffer(aLength, aAlignMask); } \
64 : NS_IMETHOD_(void) PutBuffer(char *aBuffer, PRUint32 aLength) { return _to PutBuffer(aBuffer, aLength); } \
65 : NS_SCRIPTABLE NS_IMETHOD DisableBuffering(void) { return _to DisableBuffering(); } \
66 : NS_SCRIPTABLE NS_IMETHOD EnableBuffering(void) { return _to EnableBuffering(); } \
67 : NS_SCRIPTABLE NS_IMETHOD GetUnbufferedStream(nsISupports * *aUnbufferedStream) { return _to GetUnbufferedStream(aUnbufferedStream); }
68 :
69 : /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
70 : #define NS_FORWARD_SAFE_NSISTREAMBUFFERACCESS(_to) \
71 : NS_IMETHOD_(char *) GetBuffer(PRUint32 aLength, PRUint32 aAlignMask) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetBuffer(aLength, aAlignMask); } \
72 : NS_IMETHOD_(void) PutBuffer(char *aBuffer, PRUint32 aLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->PutBuffer(aBuffer, aLength); } \
73 : NS_SCRIPTABLE NS_IMETHOD DisableBuffering(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->DisableBuffering(); } \
74 : NS_SCRIPTABLE NS_IMETHOD EnableBuffering(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->EnableBuffering(); } \
75 : NS_SCRIPTABLE NS_IMETHOD GetUnbufferedStream(nsISupports * *aUnbufferedStream) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetUnbufferedStream(aUnbufferedStream); }
76 :
77 : #if 0
78 : /* Use the code below as a template for the implementation class for this interface. */
79 :
80 : /* Header file */
81 : class nsStreamBufferAccess : public nsIStreamBufferAccess
82 : {
83 : public:
84 : NS_DECL_ISUPPORTS
85 : NS_DECL_NSISTREAMBUFFERACCESS
86 :
87 : nsStreamBufferAccess();
88 :
89 : private:
90 : ~nsStreamBufferAccess();
91 :
92 : protected:
93 : /* additional members */
94 : };
95 :
96 : /* Implementation file */
97 : NS_IMPL_ISUPPORTS1(nsStreamBufferAccess, nsIStreamBufferAccess)
98 :
99 : nsStreamBufferAccess::nsStreamBufferAccess()
100 : {
101 : /* member initializers and constructor code */
102 : }
103 :
104 : nsStreamBufferAccess::~nsStreamBufferAccess()
105 : {
106 : /* destructor code */
107 : }
108 :
109 : /* [noscript,notxpcom] charPtr getBuffer (in PRUint32 aLength, in PRUint32 aAlignMask); */
110 : NS_IMETHODIMP_(char *) nsStreamBufferAccess::GetBuffer(PRUint32 aLength, PRUint32 aAlignMask)
111 : {
112 : return NS_ERROR_NOT_IMPLEMENTED;
113 : }
114 :
115 : /* [noscript,notxpcom] void putBuffer (in charPtr aBuffer, in PRUint32 aLength); */
116 : NS_IMETHODIMP_(void) nsStreamBufferAccess::PutBuffer(char *aBuffer, PRUint32 aLength)
117 : {
118 : return NS_ERROR_NOT_IMPLEMENTED;
119 : }
120 :
121 : /* void disableBuffering (); */
122 : NS_IMETHODIMP nsStreamBufferAccess::DisableBuffering()
123 : {
124 : return NS_ERROR_NOT_IMPLEMENTED;
125 : }
126 :
127 : /* void enableBuffering (); */
128 : NS_IMETHODIMP nsStreamBufferAccess::EnableBuffering()
129 : {
130 : return NS_ERROR_NOT_IMPLEMENTED;
131 : }
132 :
133 : /* readonly attribute nsISupports unbufferedStream; */
134 : NS_IMETHODIMP nsStreamBufferAccess::GetUnbufferedStream(nsISupports * *aUnbufferedStream)
135 : {
136 : return NS_ERROR_NOT_IMPLEMENTED;
137 : }
138 :
139 : /* End of implementation class template. */
140 : #endif
141 :
142 :
143 : // Swap macros, used to convert to/from canonical (big-endian) format
144 : #if defined IS_LITTLE_ENDIAN
145 : # define NS_SWAP16(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
146 : # define NS_SWAP32(x) ((NS_SWAP16((x) & 0xffff) << 16) | (NS_SWAP16((x) >> 16)))
147 : // We want to avoid casting to 32-bit types if possible, since that violates
148 : // aliasing rules (a standard compiler may assume that pointers of two types
149 : // do not address overlapping storage).
150 : //
151 : // XXX What if we have a compiler that follows aliasing rules strictly but
152 : // doesn't have a 64-bit int type?
153 : //
154 : // XXXbe shouldn't NSPR's LL_INIT work for non-constant arguments in all cases?
155 : # if defined HAVE_LONG_LONG
156 : # if PR_BYTES_PER_LONG == 8
157 : # define ULL_(x) x ## UL
158 : # elif defined WIN32 && defined _MSC_VER
159 : # define ULL_(x) x ## ui64
160 : # else
161 : # define ULL_(x) x ## ULL
162 : # endif
163 : # define NS_SWAP64(x) ((((x) & ULL_(0xff00000000000000)) >> 56) | \
164 : (((x) & ULL_(0x00ff000000000000)) >> 40) | \
165 : (((x) & ULL_(0x0000ff0000000000)) >> 24) | \
166 : (((x) & ULL_(0x000000ff00000000)) >> 8) | \
167 : (((x) & ULL_(0x00000000ff000000)) << 8) | \
168 : (((x) & ULL_(0x0000000000ff0000)) << 24) | \
169 : (((x) & ULL_(0x000000000000ff00)) << 40) | \
170 : (((x) /* & ULL_(0x00000000000000ff) */) << 56))
171 : # else
172 : # define NS_SWAP64(x) LL_INIT((((x).lo /* & 0xff000000ul */) >> 24) | \
173 : (((x).lo & 0x00ff0000ul) >> 8) | \
174 : (((x).lo & 0x0000ff00ul) << 8) | \
175 : (((x).lo /* & 0x000000fful */) << 24), \
176 : (((x).hi /* & 0xff000000ul */) >> 24) | \
177 : (((x).hi & 0x00ff0000ul) >> 8) | \
178 : (((x).hi & 0x0000ff00ul) << 8) | \
179 : (((x).hi /* & 0x000000fful */) << 24))
180 : # endif
181 : #elif defined IS_BIG_ENDIAN
182 : # define NS_SWAP16(x) (x)
183 : # define NS_SWAP32(x) (x)
184 : # define NS_SWAP64(x) (x)
185 : #else
186 : # error "Unknown byte order"
187 : #endif
188 : /**
189 : * These macros get and put a buffer given either an sba parameter that may
190 : * point to an object implementing nsIStreamBufferAccess, nsIObjectInputStream,
191 : * or nsIObjectOutputStream.
192 : */
193 : #define NS_GET_BUFFER(sba,n,a) ((sba)->GetBuffer(n, a))
194 : #define NS_PUT_BUFFER(sba,p,n) ((sba)->PutBuffer(p, n))
195 : #define NS_GET8(p) (*(PRUint8*)(p))
196 : #define NS_GET16(p) NS_SWAP16(*(PRUint16*)(p))
197 : #define NS_GET32(p) NS_SWAP32(*(PRUint32*)(p))
198 : #define NS_GET64(p) NS_SWAP64(*(PRUint64*)(p))
199 : #define NS_GET_FLOAT(p) ((float)NS_SWAP32(*(PRUint32*)(p)))
200 : #define NS_GET_DOUBLE(p) ((double)NS_SWAP64(*(PRUint64*)(p)))
201 : #define NS_PUT8(p,x) (*(PRUint8*)(p) = (x))
202 : #define NS_PUT16(p,x) (*(PRUint16*)(p) = NS_SWAP16(x))
203 : #define NS_PUT32(p,x) (*(PRUint32*)(p) = NS_SWAP32(x))
204 : #define NS_PUT64(p,x) (*(PRUint64*)(p) = NS_SWAP64(x))
205 : #define NS_PUT_FLOAT(p,x) (*(PRUint32*)(p) = NS_SWAP32(*(PRUint32*)&(x)))
206 : #define NS_PUT_DOUBLE(p,x) (*(PRUint64*)(p) = NS_SWAP64(*(PRUint64*)&(x)))
207 :
208 : #endif /* __gen_nsIStreamBufferAccess_h__ */
|