Backed out changeset 5238c09bf764 (bug 1911562) for causing android no-fis wpt failur...
[gecko.git] / xpcom / ds / nsSupportsPrimitives.h
blob28d768a1351a89dd7016d94f4186bfbc5146fd1c
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/. */
7 #ifndef nsSupportsPrimitives_h__
8 #define nsSupportsPrimitives_h__
10 #include "mozilla/Attributes.h"
12 #include "nsISupportsPrimitives.h"
13 #include "nsCOMPtr.h"
14 #include "nsString.h"
16 /***************************************************************************/
18 class nsSupportsCString final : public nsISupportsCString {
19 public:
20 NS_DECL_ISUPPORTS
21 NS_DECL_NSISUPPORTSPRIMITIVE
22 NS_DECL_NSISUPPORTSCSTRING
24 nsSupportsCString() = default;
26 private:
27 ~nsSupportsCString() = default;
29 nsCString mData;
32 /***************************************************************************/
34 class nsSupportsString final : public nsISupportsString {
35 public:
36 NS_DECL_ISUPPORTS
37 NS_DECL_NSISUPPORTSPRIMITIVE
38 NS_DECL_NSISUPPORTSSTRING
40 nsSupportsString() = default;
42 private:
43 ~nsSupportsString() = default;
45 nsString mData;
48 /***************************************************************************/
50 class nsSupportsPRBool final : public nsISupportsPRBool {
51 public:
52 NS_DECL_THREADSAFE_ISUPPORTS
53 NS_DECL_NSISUPPORTSPRIMITIVE
54 NS_DECL_NSISUPPORTSPRBOOL
56 nsSupportsPRBool();
58 private:
59 ~nsSupportsPRBool() = default;
61 bool mData;
64 /***************************************************************************/
66 class nsSupportsPRUint8 final : public nsISupportsPRUint8 {
67 public:
68 NS_DECL_ISUPPORTS
69 NS_DECL_NSISUPPORTSPRIMITIVE
70 NS_DECL_NSISUPPORTSPRUINT8
72 nsSupportsPRUint8();
74 private:
75 ~nsSupportsPRUint8() = default;
77 uint8_t mData;
80 /***************************************************************************/
82 class nsSupportsPRUint16 final : public nsISupportsPRUint16 {
83 public:
84 NS_DECL_ISUPPORTS
85 NS_DECL_NSISUPPORTSPRIMITIVE
86 NS_DECL_NSISUPPORTSPRUINT16
88 nsSupportsPRUint16();
90 private:
91 ~nsSupportsPRUint16() = default;
93 uint16_t mData;
96 /***************************************************************************/
98 class nsSupportsPRUint32 final : public nsISupportsPRUint32 {
99 public:
100 NS_DECL_ISUPPORTS
101 NS_DECL_NSISUPPORTSPRIMITIVE
102 NS_DECL_NSISUPPORTSPRUINT32
104 nsSupportsPRUint32();
106 private:
107 ~nsSupportsPRUint32() = default;
109 uint32_t mData;
112 /***************************************************************************/
114 class nsSupportsPRUint64 final : public nsISupportsPRUint64 {
115 public:
116 NS_DECL_ISUPPORTS
117 NS_DECL_NSISUPPORTSPRIMITIVE
118 NS_DECL_NSISUPPORTSPRUINT64
120 nsSupportsPRUint64();
122 private:
123 ~nsSupportsPRUint64() = default;
125 uint64_t mData;
128 /***************************************************************************/
130 class nsSupportsPRTime final : public nsISupportsPRTime {
131 public:
132 NS_DECL_ISUPPORTS
133 NS_DECL_NSISUPPORTSPRIMITIVE
134 NS_DECL_NSISUPPORTSPRTIME
136 nsSupportsPRTime();
138 private:
139 ~nsSupportsPRTime() = default;
141 PRTime mData;
144 /***************************************************************************/
146 class nsSupportsChar final : public nsISupportsChar {
147 public:
148 NS_DECL_ISUPPORTS
149 NS_DECL_NSISUPPORTSPRIMITIVE
150 NS_DECL_NSISUPPORTSCHAR
152 nsSupportsChar();
154 private:
155 ~nsSupportsChar() = default;
157 char mData;
160 /***************************************************************************/
162 class nsSupportsPRInt16 final : public nsISupportsPRInt16 {
163 public:
164 NS_DECL_ISUPPORTS
165 NS_DECL_NSISUPPORTSPRIMITIVE
166 NS_DECL_NSISUPPORTSPRINT16
168 nsSupportsPRInt16();
170 private:
171 ~nsSupportsPRInt16() = default;
173 int16_t mData;
176 /***************************************************************************/
178 class nsSupportsPRInt32 final : public nsISupportsPRInt32 {
179 public:
180 NS_DECL_ISUPPORTS
181 NS_DECL_NSISUPPORTSPRIMITIVE
182 NS_DECL_NSISUPPORTSPRINT32
184 nsSupportsPRInt32();
186 private:
187 ~nsSupportsPRInt32() = default;
189 int32_t mData;
192 /***************************************************************************/
194 class nsSupportsPRInt64 final : public nsISupportsPRInt64 {
195 public:
196 NS_DECL_ISUPPORTS
197 NS_DECL_NSISUPPORTSPRIMITIVE
198 NS_DECL_NSISUPPORTSPRINT64
200 nsSupportsPRInt64();
202 private:
203 ~nsSupportsPRInt64() = default;
205 int64_t mData;
208 /***************************************************************************/
210 class nsSupportsFloat final : public nsISupportsFloat {
211 public:
212 NS_DECL_ISUPPORTS
213 NS_DECL_NSISUPPORTSPRIMITIVE
214 NS_DECL_NSISUPPORTSFLOAT
216 nsSupportsFloat();
218 private:
219 ~nsSupportsFloat() = default;
221 float mData;
224 /***************************************************************************/
226 class nsSupportsDouble final : public nsISupportsDouble {
227 public:
228 NS_DECL_ISUPPORTS
229 NS_DECL_NSISUPPORTSPRIMITIVE
230 NS_DECL_NSISUPPORTSDOUBLE
232 nsSupportsDouble();
234 private:
235 ~nsSupportsDouble() = default;
237 double mData;
240 /***************************************************************************/
242 class nsSupportsInterfacePointer final : public nsISupportsInterfacePointer {
243 public:
244 NS_DECL_THREADSAFE_ISUPPORTS
245 NS_DECL_NSISUPPORTSPRIMITIVE
246 NS_DECL_NSISUPPORTSINTERFACEPOINTER
248 nsSupportsInterfacePointer();
250 private:
251 ~nsSupportsInterfacePointer();
253 nsCOMPtr<nsISupports> mData;
254 nsID* mIID;
257 /***************************************************************************/
260 * Wraps a static const char* buffer for use with nsISupportsCString
262 * Only use this class with static buffers, or arena-allocated buffers of
263 * permanent lifetime!
265 class nsSupportsDependentCString final : public nsISupportsCString {
266 public:
267 NS_DECL_ISUPPORTS
268 NS_DECL_NSISUPPORTSPRIMITIVE
269 NS_DECL_NSISUPPORTSCSTRING
271 explicit nsSupportsDependentCString(const char* aStr);
273 private:
274 ~nsSupportsDependentCString() = default;
276 nsDependentCString mData;
279 #endif /* nsSupportsPrimitives_h__ */