/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/** * Map the nsAUTF8String, nsUTF8String classes to the nsACString and * nsCString classes respectively for now. These defines need to be removed * once Jag lands his nsUTF8String implementation.
*/ #define nsAUTF8String nsACString #define nsUTF8String nsCString #define PromiseFlatUTF8String PromiseFlatCString
/** * nsDiscriminatedUnion is a class that nsIVariant implementors can use * to hold the underlying data.
*/
// Like SetFromWStringWithSize, but leaves the string uninitialized. It does // does write the null-terminator. void AllocateWStringWithSize(uint32_t aSize);
public: union {
int8_t mInt8Value;
int16_t mInt16Value;
int32_t mInt32Value;
int64_t mInt64Value;
uint8_t mUint8Value;
uint16_t mUint16Value;
uint32_t mUint32Value;
uint64_t mUint64Value; float mFloatValue; double mDoubleValue; bool mBoolValue; char mCharValue;
char16_t mWCharValue;
nsIID mIDValue;
nsAString* mAStringValue;
nsAUTF8String* mUTF8StringValue;
nsACString* mCStringValue; struct { // This is an owning reference that cannot be an nsCOMPtr because // nsDiscriminatedUnion needs to be POD. AddRef/Release are manually // called on this.
nsISupports* MOZ_OWNING_REF mInterfaceValue;
nsIID mInterfaceID;
} iface; struct {
nsIID mArrayInterfaceID; void* mArrayValue;
uint32_t mArrayCount;
uint16_t mArrayType;
} array; struct { char* mStringValue;
uint32_t mStringLength;
} str; struct {
char16_t* mWStringValue;
uint32_t mWStringLength;
} wstr;
} u;
uint16_t mType;
};
/** * nsVariant implements the generic variant support. The xpcom module registers * a factory (see NS_VARIANT_CONTRACTID in nsIVariant.idl) that will create * these objects. They are created 'empty' and 'writable'. * * nsIVariant users won't usually need to see this class.
*/ class nsVariantBase : public nsIWritableVariant { public:
NS_DECL_NSIVARIANT
NS_DECL_NSIWRITABLEVARIANT
nsVariantBase();
protected:
~nsVariantBase() = default;
nsDiscriminatedUnion mData; bool mWritable;
};
class nsVariant final : public nsVariantBase { public:
NS_DECL_ISUPPORTS
nsVariant() = default;
private:
~nsVariant() = default;
};
class nsVariantCC final : public nsVariantBase { public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(nsVariantCC)
nsVariantCC() = default;
private:
~nsVariantCC() = default;
};
/** * Users of nsIVariant should be using the contractID and not this CID. * - see NS_VARIANT_CONTRACTID in nsIVariant.idl.
*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.