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 <dr@netscape.com>
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 "mozilla/Attributes.h"
43 :
44 : #include "nsISupportsPrimitives.h"
45 : #include "nsCOMPtr.h"
46 : #include "nsString.h"
47 : #include "nsDependentString.h"
48 :
49 : class nsSupportsIDImpl MOZ_FINAL : public nsISupportsID
50 : {
51 : public:
52 : NS_DECL_ISUPPORTS
53 : NS_DECL_NSISUPPORTSPRIMITIVE
54 : NS_DECL_NSISUPPORTSID
55 :
56 : nsSupportsIDImpl();
57 :
58 : private:
59 0 : ~nsSupportsIDImpl() { }
60 :
61 : nsID *mData;
62 : };
63 :
64 : /***************************************************************************/
65 :
66 : class nsSupportsCStringImpl MOZ_FINAL : public nsISupportsCString
67 : {
68 : public:
69 : NS_DECL_ISUPPORTS
70 : NS_DECL_NSISUPPORTSPRIMITIVE
71 : NS_DECL_NSISUPPORTSCSTRING
72 :
73 233 : nsSupportsCStringImpl() {}
74 :
75 : private:
76 233 : ~nsSupportsCStringImpl() {}
77 :
78 : nsCString mData;
79 : };
80 :
81 : /***************************************************************************/
82 :
83 : class nsSupportsStringImpl MOZ_FINAL : public nsISupportsString
84 : {
85 : public:
86 : NS_DECL_ISUPPORTS
87 : NS_DECL_NSISUPPORTSPRIMITIVE
88 : NS_DECL_NSISUPPORTSSTRING
89 :
90 34475 : nsSupportsStringImpl() {}
91 :
92 : private:
93 34475 : ~nsSupportsStringImpl() {}
94 :
95 : nsString mData;
96 : };
97 :
98 : /***************************************************************************/
99 :
100 : class nsSupportsPRBoolImpl MOZ_FINAL : public nsISupportsPRBool
101 : {
102 : public:
103 : NS_DECL_ISUPPORTS
104 : NS_DECL_NSISUPPORTSPRIMITIVE
105 : NS_DECL_NSISUPPORTSPRBOOL
106 :
107 : nsSupportsPRBoolImpl();
108 :
109 : private:
110 474 : ~nsSupportsPRBoolImpl() {}
111 :
112 : bool mData;
113 : };
114 :
115 : /***************************************************************************/
116 :
117 : class nsSupportsPRUint8Impl MOZ_FINAL : public nsISupportsPRUint8
118 : {
119 : public:
120 : NS_DECL_ISUPPORTS
121 : NS_DECL_NSISUPPORTSPRIMITIVE
122 : NS_DECL_NSISUPPORTSPRUINT8
123 :
124 : nsSupportsPRUint8Impl();
125 :
126 : private:
127 1 : ~nsSupportsPRUint8Impl() {}
128 :
129 : PRUint8 mData;
130 : };
131 :
132 : /***************************************************************************/
133 :
134 : class nsSupportsPRUint16Impl MOZ_FINAL : public nsISupportsPRUint16
135 : {
136 : public:
137 : NS_DECL_ISUPPORTS
138 : NS_DECL_NSISUPPORTSPRIMITIVE
139 : NS_DECL_NSISUPPORTSPRUINT16
140 :
141 : nsSupportsPRUint16Impl();
142 :
143 : private:
144 1 : ~nsSupportsPRUint16Impl() {}
145 :
146 : PRUint16 mData;
147 : };
148 :
149 : /***************************************************************************/
150 :
151 : class nsSupportsPRUint32Impl MOZ_FINAL : public nsISupportsPRUint32
152 : {
153 : public:
154 : NS_DECL_ISUPPORTS
155 : NS_DECL_NSISUPPORTSPRIMITIVE
156 : NS_DECL_NSISUPPORTSPRUINT32
157 :
158 : nsSupportsPRUint32Impl();
159 :
160 : private:
161 14 : ~nsSupportsPRUint32Impl() {}
162 :
163 : PRUint32 mData;
164 : };
165 :
166 : /***************************************************************************/
167 :
168 : class nsSupportsPRUint64Impl MOZ_FINAL : public nsISupportsPRUint64
169 : {
170 : public:
171 : NS_DECL_ISUPPORTS
172 : NS_DECL_NSISUPPORTSPRIMITIVE
173 : NS_DECL_NSISUPPORTSPRUINT64
174 :
175 : nsSupportsPRUint64Impl();
176 :
177 : private:
178 1 : ~nsSupportsPRUint64Impl() {}
179 :
180 : PRUint64 mData;
181 : };
182 :
183 : /***************************************************************************/
184 :
185 : class nsSupportsPRTimeImpl MOZ_FINAL : public nsISupportsPRTime
186 : {
187 : public:
188 : NS_DECL_ISUPPORTS
189 : NS_DECL_NSISUPPORTSPRIMITIVE
190 : NS_DECL_NSISUPPORTSPRTIME
191 :
192 : nsSupportsPRTimeImpl();
193 :
194 : private:
195 0 : ~nsSupportsPRTimeImpl() {}
196 :
197 : PRTime mData;
198 : };
199 :
200 : /***************************************************************************/
201 :
202 : class nsSupportsCharImpl MOZ_FINAL : public nsISupportsChar
203 : {
204 : public:
205 : NS_DECL_ISUPPORTS
206 : NS_DECL_NSISUPPORTSPRIMITIVE
207 : NS_DECL_NSISUPPORTSCHAR
208 :
209 : nsSupportsCharImpl();
210 :
211 : private:
212 0 : ~nsSupportsCharImpl() {}
213 :
214 : char mData;
215 : };
216 :
217 : /***************************************************************************/
218 :
219 : class nsSupportsPRInt16Impl MOZ_FINAL : public nsISupportsPRInt16
220 : {
221 : public:
222 : NS_DECL_ISUPPORTS
223 : NS_DECL_NSISUPPORTSPRIMITIVE
224 : NS_DECL_NSISUPPORTSPRINT16
225 :
226 : nsSupportsPRInt16Impl();
227 :
228 : private:
229 1 : ~nsSupportsPRInt16Impl() {}
230 :
231 : PRInt16 mData;
232 : };
233 :
234 : /***************************************************************************/
235 :
236 : class nsSupportsPRInt32Impl MOZ_FINAL : public nsISupportsPRInt32
237 : {
238 : public:
239 : NS_DECL_ISUPPORTS
240 : NS_DECL_NSISUPPORTSPRIMITIVE
241 : NS_DECL_NSISUPPORTSPRINT32
242 :
243 : nsSupportsPRInt32Impl();
244 :
245 : private:
246 1 : ~nsSupportsPRInt32Impl() {}
247 :
248 : PRInt32 mData;
249 : };
250 :
251 : /***************************************************************************/
252 :
253 : class nsSupportsPRInt64Impl MOZ_FINAL : public nsISupportsPRInt64
254 : {
255 : public:
256 : NS_DECL_ISUPPORTS
257 : NS_DECL_NSISUPPORTSPRIMITIVE
258 : NS_DECL_NSISUPPORTSPRINT64
259 :
260 : nsSupportsPRInt64Impl();
261 :
262 : private:
263 33 : ~nsSupportsPRInt64Impl() {}
264 :
265 : PRInt64 mData;
266 : };
267 :
268 : /***************************************************************************/
269 :
270 : class nsSupportsFloatImpl MOZ_FINAL : public nsISupportsFloat
271 : {
272 : public:
273 : NS_DECL_ISUPPORTS
274 : NS_DECL_NSISUPPORTSPRIMITIVE
275 : NS_DECL_NSISUPPORTSFLOAT
276 :
277 : nsSupportsFloatImpl();
278 :
279 : private:
280 1 : ~nsSupportsFloatImpl() {}
281 :
282 : float mData;
283 : };
284 :
285 : /***************************************************************************/
286 :
287 : class nsSupportsDoubleImpl MOZ_FINAL : public nsISupportsDouble
288 : {
289 : public:
290 : NS_DECL_ISUPPORTS
291 : NS_DECL_NSISUPPORTSPRIMITIVE
292 : NS_DECL_NSISUPPORTSDOUBLE
293 :
294 : nsSupportsDoubleImpl();
295 :
296 : private:
297 1 : ~nsSupportsDoubleImpl() {}
298 :
299 : double mData;
300 : };
301 :
302 : /***************************************************************************/
303 :
304 : class nsSupportsVoidImpl MOZ_FINAL : public nsISupportsVoid
305 : {
306 : public:
307 : NS_DECL_ISUPPORTS
308 : NS_DECL_NSISUPPORTSPRIMITIVE
309 : NS_DECL_NSISUPPORTSVOID
310 :
311 : nsSupportsVoidImpl();
312 :
313 : private:
314 0 : ~nsSupportsVoidImpl() {}
315 :
316 : void* mData;
317 : };
318 :
319 : /***************************************************************************/
320 :
321 : class nsSupportsInterfacePointerImpl MOZ_FINAL : public nsISupportsInterfacePointer
322 : {
323 : public:
324 : NS_DECL_ISUPPORTS
325 : NS_DECL_NSISUPPORTSPRIMITIVE
326 : NS_DECL_NSISUPPORTSINTERFACEPOINTER
327 :
328 : nsSupportsInterfacePointerImpl();
329 :
330 : private:
331 : ~nsSupportsInterfacePointerImpl();
332 :
333 : nsCOMPtr<nsISupports> mData;
334 : nsID *mIID;
335 : };
336 :
337 : /***************************************************************************/
338 :
339 : /**
340 : * Wraps a static const char* buffer for use with nsISupportsCString
341 : *
342 : * Only use this class with static buffers, or arena-allocated buffers of
343 : * permanent lifetime!
344 : */
345 : class nsSupportsDependentCString MOZ_FINAL : public nsISupportsCString
346 : {
347 : public:
348 : NS_DECL_ISUPPORTS
349 : NS_DECL_NSISUPPORTSPRIMITIVE
350 : NS_DECL_NSISUPPORTSCSTRING
351 :
352 : nsSupportsDependentCString(const char* aStr);
353 :
354 : private:
355 7111 : ~nsSupportsDependentCString() {}
356 :
357 : nsDependentCString mData;
358 : };
359 :
360 : #endif /* nsSupportsPrimitives_h__ */
|