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