xpcom/ds/nsSupportsPrimitives.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial