1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
---|
2 | /* ***** BEGIN LICENSE BLOCK *****
|
---|
3 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
---|
4 | *
|
---|
5 | * The contents of this file are subject to the Mozilla Public License Version
|
---|
6 | * 1.1 (the "License"); you may not use this file except in compliance with
|
---|
7 | * the License. You may obtain a copy of the License at
|
---|
8 | * http://www.mozilla.org/MPL/
|
---|
9 | *
|
---|
10 | * Software distributed under the License is distributed on an "AS IS" basis,
|
---|
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
---|
12 | * for the specific language governing rights and limitations under the
|
---|
13 | * License.
|
---|
14 | *
|
---|
15 | * The Original Code is mozilla.org code.
|
---|
16 | *
|
---|
17 | * The Initial Developer of the Original Code is
|
---|
18 | * Netscape Communications Corporation.
|
---|
19 | * Portions created by the Initial Developer are Copyright (C) 1998
|
---|
20 | * the Initial Developer. All Rights Reserved.
|
---|
21 | *
|
---|
22 | * Contributor(s):
|
---|
23 | * Dan Rosen <[email protected]>
|
---|
24 | *
|
---|
25 | * Alternatively, the contents of this file may be used under the terms of
|
---|
26 | * either of the GNU General Public License Version 2 or later (the "GPL"),
|
---|
27 | * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
---|
28 | * in which case the provisions of the GPL or the LGPL are applicable instead
|
---|
29 | * of those above. If you wish to allow use of your version of this file only
|
---|
30 | * under the terms of either the GPL or the LGPL, and not to allow others to
|
---|
31 | * use your version of this file under the terms of the MPL, indicate your
|
---|
32 | * decision by deleting the provisions above and replace them with the notice
|
---|
33 | * and other provisions required by the GPL or the LGPL. If you do not delete
|
---|
34 | * the provisions above, a recipient may use your version of this file under
|
---|
35 | * the terms of any one of the MPL, the GPL or the LGPL.
|
---|
36 | *
|
---|
37 | * ***** END LICENSE BLOCK ***** */
|
---|
38 |
|
---|
39 | #ifndef nsSupportsPrimitives_h__
|
---|
40 | #define nsSupportsPrimitives_h__
|
---|
41 |
|
---|
42 | #include "nsISupportsPrimitives.h"
|
---|
43 | #include "nsCOMPtr.h"
|
---|
44 | #include "nsString.h"
|
---|
45 | #include "nsDependentString.h"
|
---|
46 |
|
---|
47 | class nsSupportsIDImpl : public nsISupportsID
|
---|
48 | {
|
---|
49 | public:
|
---|
50 | NS_DECL_ISUPPORTS
|
---|
51 | NS_DECL_NSISUPPORTSPRIMITIVE
|
---|
52 | NS_DECL_NSISUPPORTSID
|
---|
53 |
|
---|
54 | nsSupportsIDImpl();
|
---|
55 |
|
---|
56 | private:
|
---|
57 | ~nsSupportsIDImpl() { }
|
---|
58 |
|
---|
59 | nsID *mData;
|
---|
60 | };
|
---|
61 |
|
---|
62 | /***************************************************************************/
|
---|
63 |
|
---|
64 | class nsSupportsCStringImpl : public nsISupportsCString
|
---|
65 | {
|
---|
66 | public:
|
---|
67 | NS_DECL_ISUPPORTS
|
---|
68 | NS_DECL_NSISUPPORTSPRIMITIVE
|
---|
69 | NS_DECL_NSISUPPORTSCSTRING
|
---|
70 |
|
---|
71 | nsSupportsCStringImpl() {}
|
---|
72 |
|
---|
73 | private:
|
---|
74 | ~nsSupportsCStringImpl() {}
|
---|
75 |
|
---|
76 | nsCString mData;
|
---|
77 | };
|
---|
78 |
|
---|
79 | /***************************************************************************/
|
---|
80 |
|
---|
81 | class nsSupportsStringImpl : public nsISupportsString
|
---|
82 | {
|
---|
83 | public:
|
---|
84 | NS_DECL_ISUPPORTS
|
---|
85 | NS_DECL_NSISUPPORTSPRIMITIVE
|
---|
86 | NS_DECL_NSISUPPORTSSTRING
|
---|
87 |
|
---|
88 | nsSupportsStringImpl() {}
|
---|
89 |
|
---|
90 | private:
|
---|
91 | ~nsSupportsStringImpl() {}
|
---|
92 |
|
---|
93 | nsString mData;
|
---|
94 | };
|
---|
95 |
|
---|
96 | /***************************************************************************/
|
---|
97 |
|
---|
98 | class nsSupportsPRBoolImpl : public nsISupportsPRBool
|
---|
99 | {
|
---|
100 | public:
|
---|
101 | NS_DECL_ISUPPORTS
|
---|
102 | NS_DECL_NSISUPPORTSPRIMITIVE
|
---|
103 | NS_DECL_NSISUPPORTSPRBOOL
|
---|
104 |
|
---|
105 | nsSupportsPRBoolImpl();
|
---|
106 |
|
---|
107 | private:
|
---|
108 | ~nsSupportsPRBoolImpl() {}
|
---|
109 |
|
---|
110 | PRBool mData;
|
---|
111 | };
|
---|
112 |
|
---|
113 | /***************************************************************************/
|
---|
114 |
|
---|
115 | class nsSupportsPRUint8Impl : public nsISupportsPRUint8
|
---|
116 | {
|
---|
117 | public:
|
---|
118 | NS_DECL_ISUPPORTS
|
---|
119 | NS_DECL_NSISUPPORTSPRIMITIVE
|
---|
120 | NS_DECL_NSISUPPORTSPRUINT8
|
---|
121 |
|
---|
122 | nsSupportsPRUint8Impl();
|
---|
123 |
|
---|
124 | private:
|
---|
125 | ~nsSupportsPRUint8Impl() {}
|
---|
126 |
|
---|
127 | PRUint8 mData;
|
---|
128 | };
|
---|
129 |
|
---|
130 | /***************************************************************************/
|
---|
131 |
|
---|
132 | class nsSupportsPRUint16Impl : public nsISupportsPRUint16
|
---|
133 | {
|
---|
134 | public:
|
---|
135 | NS_DECL_ISUPPORTS
|
---|
136 | NS_DECL_NSISUPPORTSPRIMITIVE
|
---|
137 | NS_DECL_NSISUPPORTSPRUINT16
|
---|
138 |
|
---|
139 | nsSupportsPRUint16Impl();
|
---|
140 |
|
---|
141 | private:
|
---|
142 | ~nsSupportsPRUint16Impl() {}
|
---|
143 |
|
---|
144 | PRUint16 mData;
|
---|
145 | };
|
---|
146 |
|
---|
147 | /***************************************************************************/
|
---|
148 |
|
---|
149 | class nsSupportsPRUint32Impl : public nsISupportsPRUint32
|
---|
150 | {
|
---|
151 | public:
|
---|
152 | NS_DECL_ISUPPORTS
|
---|
153 | NS_DECL_NSISUPPORTSPRIMITIVE
|
---|
154 | NS_DECL_NSISUPPORTSPRUINT32
|
---|
155 |
|
---|
156 | nsSupportsPRUint32Impl();
|
---|
157 |
|
---|
158 | private:
|
---|
159 | ~nsSupportsPRUint32Impl() {}
|
---|
160 |
|
---|
161 | PRUint32 mData;
|
---|
162 | };
|
---|
163 |
|
---|
164 | /***************************************************************************/
|
---|
165 |
|
---|
166 | class nsSupportsPRUint64Impl : public nsISupportsPRUint64
|
---|
167 | {
|
---|
168 | public:
|
---|
169 | NS_DECL_ISUPPORTS
|
---|
170 | NS_DECL_NSISUPPORTSPRIMITIVE
|
---|
171 | NS_DECL_NSISUPPORTSPRUINT64
|
---|
172 |
|
---|
173 | nsSupportsPRUint64Impl();
|
---|
174 |
|
---|
175 | private:
|
---|
176 | ~nsSupportsPRUint64Impl() {}
|
---|
177 |
|
---|
178 | PRUint64 mData;
|
---|
179 | };
|
---|
180 |
|
---|
181 | /***************************************************************************/
|
---|
182 |
|
---|
183 | class nsSupportsPRTimeImpl : public nsISupportsPRTime
|
---|
184 | {
|
---|
185 | public:
|
---|
186 | NS_DECL_ISUPPORTS
|
---|
187 | NS_DECL_NSISUPPORTSPRIMITIVE
|
---|
188 | NS_DECL_NSISUPPORTSPRTIME
|
---|
189 |
|
---|
190 | nsSupportsPRTimeImpl();
|
---|
191 |
|
---|
192 | private:
|
---|
193 | ~nsSupportsPRTimeImpl() {}
|
---|
194 |
|
---|
195 | PRTime mData;
|
---|
196 | };
|
---|
197 |
|
---|
198 | /***************************************************************************/
|
---|
199 |
|
---|
200 | class nsSupportsCharImpl : public nsISupportsChar
|
---|
201 | {
|
---|
202 | public:
|
---|
203 | NS_DECL_ISUPPORTS
|
---|
204 | NS_DECL_NSISUPPORTSPRIMITIVE
|
---|
205 | NS_DECL_NSISUPPORTSCHAR
|
---|
206 |
|
---|
207 | nsSupportsCharImpl();
|
---|
208 |
|
---|
209 | private:
|
---|
210 | ~nsSupportsCharImpl() {}
|
---|
211 |
|
---|
212 | char mData;
|
---|
213 | };
|
---|
214 |
|
---|
215 | /***************************************************************************/
|
---|
216 |
|
---|
217 | class nsSupportsPRInt16Impl : public nsISupportsPRInt16
|
---|
218 | {
|
---|
219 | public:
|
---|
220 | NS_DECL_ISUPPORTS
|
---|
221 | NS_DECL_NSISUPPORTSPRIMITIVE
|
---|
222 | NS_DECL_NSISUPPORTSPRINT16
|
---|
223 |
|
---|
224 | nsSupportsPRInt16Impl();
|
---|
225 |
|
---|
226 | private:
|
---|
227 | ~nsSupportsPRInt16Impl() {}
|
---|
228 |
|
---|
229 | PRInt16 mData;
|
---|
230 | };
|
---|
231 |
|
---|
232 | /***************************************************************************/
|
---|
233 |
|
---|
234 | class nsSupportsPRInt32Impl : public nsISupportsPRInt32
|
---|
235 | {
|
---|
236 | public:
|
---|
237 | NS_DECL_ISUPPORTS
|
---|
238 | NS_DECL_NSISUPPORTSPRIMITIVE
|
---|
239 | NS_DECL_NSISUPPORTSPRINT32
|
---|
240 |
|
---|
241 | nsSupportsPRInt32Impl();
|
---|
242 |
|
---|
243 | private:
|
---|
244 | ~nsSupportsPRInt32Impl() {}
|
---|
245 |
|
---|
246 | PRInt32 mData;
|
---|
247 | };
|
---|
248 |
|
---|
249 | /***************************************************************************/
|
---|
250 |
|
---|
251 | class nsSupportsPRInt64Impl : public nsISupportsPRInt64
|
---|
252 | {
|
---|
253 | public:
|
---|
254 | NS_DECL_ISUPPORTS
|
---|
255 | NS_DECL_NSISUPPORTSPRIMITIVE
|
---|
256 | NS_DECL_NSISUPPORTSPRINT64
|
---|
257 |
|
---|
258 | nsSupportsPRInt64Impl();
|
---|
259 |
|
---|
260 | private:
|
---|
261 | ~nsSupportsPRInt64Impl() {}
|
---|
262 |
|
---|
263 | PRInt64 mData;
|
---|
264 | };
|
---|
265 |
|
---|
266 | /***************************************************************************/
|
---|
267 |
|
---|
268 | class nsSupportsFloatImpl : public nsISupportsFloat
|
---|
269 | {
|
---|
270 | public:
|
---|
271 | NS_DECL_ISUPPORTS
|
---|
272 | NS_DECL_NSISUPPORTSPRIMITIVE
|
---|
273 | NS_DECL_NSISUPPORTSFLOAT
|
---|
274 |
|
---|
275 | nsSupportsFloatImpl();
|
---|
276 |
|
---|
277 | private:
|
---|
278 | ~nsSupportsFloatImpl() {}
|
---|
279 |
|
---|
280 | float mData;
|
---|
281 | };
|
---|
282 |
|
---|
283 | /***************************************************************************/
|
---|
284 |
|
---|
285 | class nsSupportsDoubleImpl : public nsISupportsDouble
|
---|
286 | {
|
---|
287 | public:
|
---|
288 | NS_DECL_ISUPPORTS
|
---|
289 | NS_DECL_NSISUPPORTSPRIMITIVE
|
---|
290 | NS_DECL_NSISUPPORTSDOUBLE
|
---|
291 |
|
---|
292 | nsSupportsDoubleImpl();
|
---|
293 |
|
---|
294 | private:
|
---|
295 | ~nsSupportsDoubleImpl() {}
|
---|
296 |
|
---|
297 | double mData;
|
---|
298 | };
|
---|
299 |
|
---|
300 | /***************************************************************************/
|
---|
301 |
|
---|
302 | class nsSupportsVoidImpl : public nsISupportsVoid
|
---|
303 | {
|
---|
304 | public:
|
---|
305 | NS_DECL_ISUPPORTS
|
---|
306 | NS_DECL_NSISUPPORTSPRIMITIVE
|
---|
307 | NS_DECL_NSISUPPORTSVOID
|
---|
308 |
|
---|
309 | nsSupportsVoidImpl();
|
---|
310 |
|
---|
311 | private:
|
---|
312 | ~nsSupportsVoidImpl() {}
|
---|
313 |
|
---|
314 | void* mData;
|
---|
315 | };
|
---|
316 |
|
---|
317 | /***************************************************************************/
|
---|
318 |
|
---|
319 | class nsSupportsInterfacePointerImpl : public nsISupportsInterfacePointer
|
---|
320 | {
|
---|
321 | public:
|
---|
322 | NS_DECL_ISUPPORTS
|
---|
323 | NS_DECL_NSISUPPORTSPRIMITIVE
|
---|
324 | NS_DECL_NSISUPPORTSINTERFACEPOINTER
|
---|
325 |
|
---|
326 | nsSupportsInterfacePointerImpl();
|
---|
327 |
|
---|
328 | private:
|
---|
329 | ~nsSupportsInterfacePointerImpl();
|
---|
330 |
|
---|
331 | nsCOMPtr<nsISupports> mData;
|
---|
332 | nsID *mIID;
|
---|
333 | };
|
---|
334 |
|
---|
335 | /***************************************************************************/
|
---|
336 |
|
---|
337 | /**
|
---|
338 | * Wraps a static const char* buffer for use with nsISupportsCString
|
---|
339 | *
|
---|
340 | * Only use this class with static buffers, or arena-allocated buffers of
|
---|
341 | * permanent lifetime!
|
---|
342 | */
|
---|
343 | class nsSupportsDependentCString : public nsISupportsCString
|
---|
344 | {
|
---|
345 | public:
|
---|
346 | NS_DECL_ISUPPORTS
|
---|
347 | NS_DECL_NSISUPPORTSPRIMITIVE
|
---|
348 | NS_DECL_NSISUPPORTSCSTRING
|
---|
349 |
|
---|
350 | nsSupportsDependentCString(const char* aStr);
|
---|
351 |
|
---|
352 | private:
|
---|
353 | ~nsSupportsDependentCString() {}
|
---|
354 |
|
---|
355 | nsDependentCString mData;
|
---|
356 | };
|
---|
357 |
|
---|
358 | #endif /* nsSupportsPrimitives_h__ */
|
---|