|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef nsSupportsPrimitives_h__ |
|
7 #define nsSupportsPrimitives_h__ |
|
8 |
|
9 #include "mozilla/Attributes.h" |
|
10 |
|
11 #include "nsISupportsPrimitives.h" |
|
12 #include "nsCOMPtr.h" |
|
13 #include "nsString.h" |
|
14 |
|
15 class nsSupportsIDImpl MOZ_FINAL : public nsISupportsID |
|
16 { |
|
17 public: |
|
18 NS_DECL_ISUPPORTS |
|
19 NS_DECL_NSISUPPORTSPRIMITIVE |
|
20 NS_DECL_NSISUPPORTSID |
|
21 |
|
22 nsSupportsIDImpl(); |
|
23 |
|
24 private: |
|
25 ~nsSupportsIDImpl() { } |
|
26 |
|
27 nsID *mData; |
|
28 }; |
|
29 |
|
30 /***************************************************************************/ |
|
31 |
|
32 class nsSupportsCStringImpl MOZ_FINAL : public nsISupportsCString |
|
33 { |
|
34 public: |
|
35 NS_DECL_ISUPPORTS |
|
36 NS_DECL_NSISUPPORTSPRIMITIVE |
|
37 NS_DECL_NSISUPPORTSCSTRING |
|
38 |
|
39 nsSupportsCStringImpl() {} |
|
40 |
|
41 private: |
|
42 ~nsSupportsCStringImpl() {} |
|
43 |
|
44 nsCString mData; |
|
45 }; |
|
46 |
|
47 /***************************************************************************/ |
|
48 |
|
49 class nsSupportsStringImpl MOZ_FINAL : public nsISupportsString |
|
50 { |
|
51 public: |
|
52 NS_DECL_ISUPPORTS |
|
53 NS_DECL_NSISUPPORTSPRIMITIVE |
|
54 NS_DECL_NSISUPPORTSSTRING |
|
55 |
|
56 nsSupportsStringImpl() {} |
|
57 |
|
58 private: |
|
59 ~nsSupportsStringImpl() {} |
|
60 |
|
61 nsString mData; |
|
62 }; |
|
63 |
|
64 /***************************************************************************/ |
|
65 |
|
66 class nsSupportsPRBoolImpl MOZ_FINAL : public nsISupportsPRBool |
|
67 { |
|
68 public: |
|
69 NS_DECL_THREADSAFE_ISUPPORTS |
|
70 NS_DECL_NSISUPPORTSPRIMITIVE |
|
71 NS_DECL_NSISUPPORTSPRBOOL |
|
72 |
|
73 nsSupportsPRBoolImpl(); |
|
74 |
|
75 private: |
|
76 ~nsSupportsPRBoolImpl() {} |
|
77 |
|
78 bool mData; |
|
79 }; |
|
80 |
|
81 /***************************************************************************/ |
|
82 |
|
83 class nsSupportsPRUint8Impl MOZ_FINAL : public nsISupportsPRUint8 |
|
84 { |
|
85 public: |
|
86 NS_DECL_ISUPPORTS |
|
87 NS_DECL_NSISUPPORTSPRIMITIVE |
|
88 NS_DECL_NSISUPPORTSPRUINT8 |
|
89 |
|
90 nsSupportsPRUint8Impl(); |
|
91 |
|
92 private: |
|
93 ~nsSupportsPRUint8Impl() {} |
|
94 |
|
95 uint8_t mData; |
|
96 }; |
|
97 |
|
98 /***************************************************************************/ |
|
99 |
|
100 class nsSupportsPRUint16Impl MOZ_FINAL : public nsISupportsPRUint16 |
|
101 { |
|
102 public: |
|
103 NS_DECL_ISUPPORTS |
|
104 NS_DECL_NSISUPPORTSPRIMITIVE |
|
105 NS_DECL_NSISUPPORTSPRUINT16 |
|
106 |
|
107 nsSupportsPRUint16Impl(); |
|
108 |
|
109 private: |
|
110 ~nsSupportsPRUint16Impl() {} |
|
111 |
|
112 uint16_t mData; |
|
113 }; |
|
114 |
|
115 /***************************************************************************/ |
|
116 |
|
117 class nsSupportsPRUint32Impl MOZ_FINAL : public nsISupportsPRUint32 |
|
118 { |
|
119 public: |
|
120 NS_DECL_ISUPPORTS |
|
121 NS_DECL_NSISUPPORTSPRIMITIVE |
|
122 NS_DECL_NSISUPPORTSPRUINT32 |
|
123 |
|
124 nsSupportsPRUint32Impl(); |
|
125 |
|
126 private: |
|
127 ~nsSupportsPRUint32Impl() {} |
|
128 |
|
129 uint32_t mData; |
|
130 }; |
|
131 |
|
132 /***************************************************************************/ |
|
133 |
|
134 class nsSupportsPRUint64Impl MOZ_FINAL : public nsISupportsPRUint64 |
|
135 { |
|
136 public: |
|
137 NS_DECL_ISUPPORTS |
|
138 NS_DECL_NSISUPPORTSPRIMITIVE |
|
139 NS_DECL_NSISUPPORTSPRUINT64 |
|
140 |
|
141 nsSupportsPRUint64Impl(); |
|
142 |
|
143 private: |
|
144 ~nsSupportsPRUint64Impl() {} |
|
145 |
|
146 uint64_t mData; |
|
147 }; |
|
148 |
|
149 /***************************************************************************/ |
|
150 |
|
151 class nsSupportsPRTimeImpl MOZ_FINAL : public nsISupportsPRTime |
|
152 { |
|
153 public: |
|
154 NS_DECL_ISUPPORTS |
|
155 NS_DECL_NSISUPPORTSPRIMITIVE |
|
156 NS_DECL_NSISUPPORTSPRTIME |
|
157 |
|
158 nsSupportsPRTimeImpl(); |
|
159 |
|
160 private: |
|
161 ~nsSupportsPRTimeImpl() {} |
|
162 |
|
163 PRTime mData; |
|
164 }; |
|
165 |
|
166 /***************************************************************************/ |
|
167 |
|
168 class nsSupportsCharImpl MOZ_FINAL : public nsISupportsChar |
|
169 { |
|
170 public: |
|
171 NS_DECL_ISUPPORTS |
|
172 NS_DECL_NSISUPPORTSPRIMITIVE |
|
173 NS_DECL_NSISUPPORTSCHAR |
|
174 |
|
175 nsSupportsCharImpl(); |
|
176 |
|
177 private: |
|
178 ~nsSupportsCharImpl() {} |
|
179 |
|
180 char mData; |
|
181 }; |
|
182 |
|
183 /***************************************************************************/ |
|
184 |
|
185 class nsSupportsPRInt16Impl MOZ_FINAL : public nsISupportsPRInt16 |
|
186 { |
|
187 public: |
|
188 NS_DECL_ISUPPORTS |
|
189 NS_DECL_NSISUPPORTSPRIMITIVE |
|
190 NS_DECL_NSISUPPORTSPRINT16 |
|
191 |
|
192 nsSupportsPRInt16Impl(); |
|
193 |
|
194 private: |
|
195 ~nsSupportsPRInt16Impl() {} |
|
196 |
|
197 int16_t mData; |
|
198 }; |
|
199 |
|
200 /***************************************************************************/ |
|
201 |
|
202 class nsSupportsPRInt32Impl MOZ_FINAL : public nsISupportsPRInt32 |
|
203 { |
|
204 public: |
|
205 NS_DECL_ISUPPORTS |
|
206 NS_DECL_NSISUPPORTSPRIMITIVE |
|
207 NS_DECL_NSISUPPORTSPRINT32 |
|
208 |
|
209 nsSupportsPRInt32Impl(); |
|
210 |
|
211 private: |
|
212 ~nsSupportsPRInt32Impl() {} |
|
213 |
|
214 int32_t mData; |
|
215 }; |
|
216 |
|
217 /***************************************************************************/ |
|
218 |
|
219 class nsSupportsPRInt64Impl MOZ_FINAL : public nsISupportsPRInt64 |
|
220 { |
|
221 public: |
|
222 NS_DECL_ISUPPORTS |
|
223 NS_DECL_NSISUPPORTSPRIMITIVE |
|
224 NS_DECL_NSISUPPORTSPRINT64 |
|
225 |
|
226 nsSupportsPRInt64Impl(); |
|
227 |
|
228 private: |
|
229 ~nsSupportsPRInt64Impl() {} |
|
230 |
|
231 int64_t mData; |
|
232 }; |
|
233 |
|
234 /***************************************************************************/ |
|
235 |
|
236 class nsSupportsFloatImpl MOZ_FINAL : public nsISupportsFloat |
|
237 { |
|
238 public: |
|
239 NS_DECL_ISUPPORTS |
|
240 NS_DECL_NSISUPPORTSPRIMITIVE |
|
241 NS_DECL_NSISUPPORTSFLOAT |
|
242 |
|
243 nsSupportsFloatImpl(); |
|
244 |
|
245 private: |
|
246 ~nsSupportsFloatImpl() {} |
|
247 |
|
248 float mData; |
|
249 }; |
|
250 |
|
251 /***************************************************************************/ |
|
252 |
|
253 class nsSupportsDoubleImpl MOZ_FINAL : public nsISupportsDouble |
|
254 { |
|
255 public: |
|
256 NS_DECL_ISUPPORTS |
|
257 NS_DECL_NSISUPPORTSPRIMITIVE |
|
258 NS_DECL_NSISUPPORTSDOUBLE |
|
259 |
|
260 nsSupportsDoubleImpl(); |
|
261 |
|
262 private: |
|
263 ~nsSupportsDoubleImpl() {} |
|
264 |
|
265 double mData; |
|
266 }; |
|
267 |
|
268 /***************************************************************************/ |
|
269 |
|
270 class nsSupportsVoidImpl MOZ_FINAL : public nsISupportsVoid |
|
271 { |
|
272 public: |
|
273 NS_DECL_THREADSAFE_ISUPPORTS |
|
274 NS_DECL_NSISUPPORTSPRIMITIVE |
|
275 NS_DECL_NSISUPPORTSVOID |
|
276 |
|
277 nsSupportsVoidImpl(); |
|
278 |
|
279 private: |
|
280 ~nsSupportsVoidImpl() {} |
|
281 |
|
282 void* mData; |
|
283 }; |
|
284 |
|
285 /***************************************************************************/ |
|
286 |
|
287 class nsSupportsInterfacePointerImpl MOZ_FINAL : public nsISupportsInterfacePointer |
|
288 { |
|
289 public: |
|
290 NS_DECL_THREADSAFE_ISUPPORTS |
|
291 NS_DECL_NSISUPPORTSPRIMITIVE |
|
292 NS_DECL_NSISUPPORTSINTERFACEPOINTER |
|
293 |
|
294 nsSupportsInterfacePointerImpl(); |
|
295 |
|
296 private: |
|
297 ~nsSupportsInterfacePointerImpl(); |
|
298 |
|
299 nsCOMPtr<nsISupports> mData; |
|
300 nsID *mIID; |
|
301 }; |
|
302 |
|
303 /***************************************************************************/ |
|
304 |
|
305 /** |
|
306 * Wraps a static const char* buffer for use with nsISupportsCString |
|
307 * |
|
308 * Only use this class with static buffers, or arena-allocated buffers of |
|
309 * permanent lifetime! |
|
310 */ |
|
311 class nsSupportsDependentCString MOZ_FINAL : public nsISupportsCString |
|
312 { |
|
313 public: |
|
314 NS_DECL_ISUPPORTS |
|
315 NS_DECL_NSISUPPORTSPRIMITIVE |
|
316 NS_DECL_NSISUPPORTSCSTRING |
|
317 |
|
318 nsSupportsDependentCString(const char* aStr); |
|
319 |
|
320 private: |
|
321 ~nsSupportsDependentCString() {} |
|
322 |
|
323 nsDependentCString mData; |
|
324 }; |
|
325 |
|
326 #endif /* nsSupportsPrimitives_h__ */ |