1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/ds/nsSupportsPrimitives.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,326 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsSupportsPrimitives_h__ 1.10 +#define nsSupportsPrimitives_h__ 1.11 + 1.12 +#include "mozilla/Attributes.h" 1.13 + 1.14 +#include "nsISupportsPrimitives.h" 1.15 +#include "nsCOMPtr.h" 1.16 +#include "nsString.h" 1.17 + 1.18 +class nsSupportsIDImpl MOZ_FINAL : public nsISupportsID 1.19 +{ 1.20 +public: 1.21 + NS_DECL_ISUPPORTS 1.22 + NS_DECL_NSISUPPORTSPRIMITIVE 1.23 + NS_DECL_NSISUPPORTSID 1.24 + 1.25 + nsSupportsIDImpl(); 1.26 + 1.27 +private: 1.28 + ~nsSupportsIDImpl() { } 1.29 + 1.30 + nsID *mData; 1.31 +}; 1.32 + 1.33 +/***************************************************************************/ 1.34 + 1.35 +class nsSupportsCStringImpl MOZ_FINAL : public nsISupportsCString 1.36 +{ 1.37 +public: 1.38 + NS_DECL_ISUPPORTS 1.39 + NS_DECL_NSISUPPORTSPRIMITIVE 1.40 + NS_DECL_NSISUPPORTSCSTRING 1.41 + 1.42 + nsSupportsCStringImpl() {} 1.43 + 1.44 +private: 1.45 + ~nsSupportsCStringImpl() {} 1.46 + 1.47 + nsCString mData; 1.48 +}; 1.49 + 1.50 +/***************************************************************************/ 1.51 + 1.52 +class nsSupportsStringImpl MOZ_FINAL : public nsISupportsString 1.53 +{ 1.54 +public: 1.55 + NS_DECL_ISUPPORTS 1.56 + NS_DECL_NSISUPPORTSPRIMITIVE 1.57 + NS_DECL_NSISUPPORTSSTRING 1.58 + 1.59 + nsSupportsStringImpl() {} 1.60 + 1.61 +private: 1.62 + ~nsSupportsStringImpl() {} 1.63 + 1.64 + nsString mData; 1.65 +}; 1.66 + 1.67 +/***************************************************************************/ 1.68 + 1.69 +class nsSupportsPRBoolImpl MOZ_FINAL : public nsISupportsPRBool 1.70 +{ 1.71 +public: 1.72 + NS_DECL_THREADSAFE_ISUPPORTS 1.73 + NS_DECL_NSISUPPORTSPRIMITIVE 1.74 + NS_DECL_NSISUPPORTSPRBOOL 1.75 + 1.76 + nsSupportsPRBoolImpl(); 1.77 + 1.78 +private: 1.79 + ~nsSupportsPRBoolImpl() {} 1.80 + 1.81 + bool mData; 1.82 +}; 1.83 + 1.84 +/***************************************************************************/ 1.85 + 1.86 +class nsSupportsPRUint8Impl MOZ_FINAL : public nsISupportsPRUint8 1.87 +{ 1.88 +public: 1.89 + NS_DECL_ISUPPORTS 1.90 + NS_DECL_NSISUPPORTSPRIMITIVE 1.91 + NS_DECL_NSISUPPORTSPRUINT8 1.92 + 1.93 + nsSupportsPRUint8Impl(); 1.94 + 1.95 +private: 1.96 + ~nsSupportsPRUint8Impl() {} 1.97 + 1.98 + uint8_t mData; 1.99 +}; 1.100 + 1.101 +/***************************************************************************/ 1.102 + 1.103 +class nsSupportsPRUint16Impl MOZ_FINAL : public nsISupportsPRUint16 1.104 +{ 1.105 +public: 1.106 + NS_DECL_ISUPPORTS 1.107 + NS_DECL_NSISUPPORTSPRIMITIVE 1.108 + NS_DECL_NSISUPPORTSPRUINT16 1.109 + 1.110 + nsSupportsPRUint16Impl(); 1.111 + 1.112 +private: 1.113 + ~nsSupportsPRUint16Impl() {} 1.114 + 1.115 + uint16_t mData; 1.116 +}; 1.117 + 1.118 +/***************************************************************************/ 1.119 + 1.120 +class nsSupportsPRUint32Impl MOZ_FINAL : public nsISupportsPRUint32 1.121 +{ 1.122 +public: 1.123 + NS_DECL_ISUPPORTS 1.124 + NS_DECL_NSISUPPORTSPRIMITIVE 1.125 + NS_DECL_NSISUPPORTSPRUINT32 1.126 + 1.127 + nsSupportsPRUint32Impl(); 1.128 + 1.129 +private: 1.130 + ~nsSupportsPRUint32Impl() {} 1.131 + 1.132 + uint32_t mData; 1.133 +}; 1.134 + 1.135 +/***************************************************************************/ 1.136 + 1.137 +class nsSupportsPRUint64Impl MOZ_FINAL : public nsISupportsPRUint64 1.138 +{ 1.139 +public: 1.140 + NS_DECL_ISUPPORTS 1.141 + NS_DECL_NSISUPPORTSPRIMITIVE 1.142 + NS_DECL_NSISUPPORTSPRUINT64 1.143 + 1.144 + nsSupportsPRUint64Impl(); 1.145 + 1.146 +private: 1.147 + ~nsSupportsPRUint64Impl() {} 1.148 + 1.149 + uint64_t mData; 1.150 +}; 1.151 + 1.152 +/***************************************************************************/ 1.153 + 1.154 +class nsSupportsPRTimeImpl MOZ_FINAL : public nsISupportsPRTime 1.155 +{ 1.156 +public: 1.157 + NS_DECL_ISUPPORTS 1.158 + NS_DECL_NSISUPPORTSPRIMITIVE 1.159 + NS_DECL_NSISUPPORTSPRTIME 1.160 + 1.161 + nsSupportsPRTimeImpl(); 1.162 + 1.163 +private: 1.164 + ~nsSupportsPRTimeImpl() {} 1.165 + 1.166 + PRTime mData; 1.167 +}; 1.168 + 1.169 +/***************************************************************************/ 1.170 + 1.171 +class nsSupportsCharImpl MOZ_FINAL : public nsISupportsChar 1.172 +{ 1.173 +public: 1.174 + NS_DECL_ISUPPORTS 1.175 + NS_DECL_NSISUPPORTSPRIMITIVE 1.176 + NS_DECL_NSISUPPORTSCHAR 1.177 + 1.178 + nsSupportsCharImpl(); 1.179 + 1.180 +private: 1.181 + ~nsSupportsCharImpl() {} 1.182 + 1.183 + char mData; 1.184 +}; 1.185 + 1.186 +/***************************************************************************/ 1.187 + 1.188 +class nsSupportsPRInt16Impl MOZ_FINAL : public nsISupportsPRInt16 1.189 +{ 1.190 +public: 1.191 + NS_DECL_ISUPPORTS 1.192 + NS_DECL_NSISUPPORTSPRIMITIVE 1.193 + NS_DECL_NSISUPPORTSPRINT16 1.194 + 1.195 + nsSupportsPRInt16Impl(); 1.196 + 1.197 +private: 1.198 + ~nsSupportsPRInt16Impl() {} 1.199 + 1.200 + int16_t mData; 1.201 +}; 1.202 + 1.203 +/***************************************************************************/ 1.204 + 1.205 +class nsSupportsPRInt32Impl MOZ_FINAL : public nsISupportsPRInt32 1.206 +{ 1.207 +public: 1.208 + NS_DECL_ISUPPORTS 1.209 + NS_DECL_NSISUPPORTSPRIMITIVE 1.210 + NS_DECL_NSISUPPORTSPRINT32 1.211 + 1.212 + nsSupportsPRInt32Impl(); 1.213 + 1.214 +private: 1.215 + ~nsSupportsPRInt32Impl() {} 1.216 + 1.217 + int32_t mData; 1.218 +}; 1.219 + 1.220 +/***************************************************************************/ 1.221 + 1.222 +class nsSupportsPRInt64Impl MOZ_FINAL : public nsISupportsPRInt64 1.223 +{ 1.224 +public: 1.225 + NS_DECL_ISUPPORTS 1.226 + NS_DECL_NSISUPPORTSPRIMITIVE 1.227 + NS_DECL_NSISUPPORTSPRINT64 1.228 + 1.229 + nsSupportsPRInt64Impl(); 1.230 + 1.231 +private: 1.232 + ~nsSupportsPRInt64Impl() {} 1.233 + 1.234 + int64_t mData; 1.235 +}; 1.236 + 1.237 +/***************************************************************************/ 1.238 + 1.239 +class nsSupportsFloatImpl MOZ_FINAL : public nsISupportsFloat 1.240 +{ 1.241 +public: 1.242 + NS_DECL_ISUPPORTS 1.243 + NS_DECL_NSISUPPORTSPRIMITIVE 1.244 + NS_DECL_NSISUPPORTSFLOAT 1.245 + 1.246 + nsSupportsFloatImpl(); 1.247 + 1.248 +private: 1.249 + ~nsSupportsFloatImpl() {} 1.250 + 1.251 + float mData; 1.252 +}; 1.253 + 1.254 +/***************************************************************************/ 1.255 + 1.256 +class nsSupportsDoubleImpl MOZ_FINAL : public nsISupportsDouble 1.257 +{ 1.258 +public: 1.259 + NS_DECL_ISUPPORTS 1.260 + NS_DECL_NSISUPPORTSPRIMITIVE 1.261 + NS_DECL_NSISUPPORTSDOUBLE 1.262 + 1.263 + nsSupportsDoubleImpl(); 1.264 + 1.265 +private: 1.266 + ~nsSupportsDoubleImpl() {} 1.267 + 1.268 + double mData; 1.269 +}; 1.270 + 1.271 +/***************************************************************************/ 1.272 + 1.273 +class nsSupportsVoidImpl MOZ_FINAL : public nsISupportsVoid 1.274 +{ 1.275 +public: 1.276 + NS_DECL_THREADSAFE_ISUPPORTS 1.277 + NS_DECL_NSISUPPORTSPRIMITIVE 1.278 + NS_DECL_NSISUPPORTSVOID 1.279 + 1.280 + nsSupportsVoidImpl(); 1.281 + 1.282 +private: 1.283 + ~nsSupportsVoidImpl() {} 1.284 + 1.285 + void* mData; 1.286 +}; 1.287 + 1.288 +/***************************************************************************/ 1.289 + 1.290 +class nsSupportsInterfacePointerImpl MOZ_FINAL : public nsISupportsInterfacePointer 1.291 +{ 1.292 +public: 1.293 + NS_DECL_THREADSAFE_ISUPPORTS 1.294 + NS_DECL_NSISUPPORTSPRIMITIVE 1.295 + NS_DECL_NSISUPPORTSINTERFACEPOINTER 1.296 + 1.297 + nsSupportsInterfacePointerImpl(); 1.298 + 1.299 +private: 1.300 + ~nsSupportsInterfacePointerImpl(); 1.301 + 1.302 + nsCOMPtr<nsISupports> mData; 1.303 + nsID *mIID; 1.304 +}; 1.305 + 1.306 +/***************************************************************************/ 1.307 + 1.308 +/** 1.309 + * Wraps a static const char* buffer for use with nsISupportsCString 1.310 + * 1.311 + * Only use this class with static buffers, or arena-allocated buffers of 1.312 + * permanent lifetime! 1.313 + */ 1.314 +class nsSupportsDependentCString MOZ_FINAL : public nsISupportsCString 1.315 +{ 1.316 +public: 1.317 + NS_DECL_ISUPPORTS 1.318 + NS_DECL_NSISUPPORTSPRIMITIVE 1.319 + NS_DECL_NSISUPPORTSCSTRING 1.320 + 1.321 + nsSupportsDependentCString(const char* aStr); 1.322 + 1.323 +private: 1.324 + ~nsSupportsDependentCString() {} 1.325 + 1.326 + nsDependentCString mData; 1.327 +}; 1.328 + 1.329 +#endif /* nsSupportsPrimitives_h__ */