Bumping manifests a=b2g-bump
[gecko.git] / xpcom / ds / nsIVariant.idl
blobef5528463d56cc06d5bec6301337b6c260a135ed
1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
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 /* The long avoided variant support for xpcom. */
9 #include "nsISupports.idl"
11 [scriptable,uuid(4d12e540-83d7-11d5-90ed-0010a4e73d9a)]
12 interface nsIDataType : nsISupports
14 // These MUST match the declarations in xpt_struct.h.
15 // Otherwise the world is likely to explode.
16 // From xpt_struct.h ...
17 const uint16_t VTYPE_INT8 = 0; // TD_INT8 = 0,
18 const uint16_t VTYPE_INT16 = 1; // TD_INT16 = 1,
19 const uint16_t VTYPE_INT32 = 2; // TD_INT32 = 2,
20 const uint16_t VTYPE_INT64 = 3; // TD_INT64 = 3,
21 const uint16_t VTYPE_UINT8 = 4; // TD_UINT8 = 4,
22 const uint16_t VTYPE_UINT16 = 5; // TD_UINT16 = 5,
23 const uint16_t VTYPE_UINT32 = 6; // TD_UINT32 = 6,
24 const uint16_t VTYPE_UINT64 = 7; // TD_UINT64 = 7,
25 const uint16_t VTYPE_FLOAT = 8; // TD_FLOAT = 8,
26 const uint16_t VTYPE_DOUBLE = 9; // TD_DOUBLE = 9,
27 const uint16_t VTYPE_BOOL = 10; // TD_BOOL = 10,
28 const uint16_t VTYPE_CHAR = 11; // TD_CHAR = 11,
29 const uint16_t VTYPE_WCHAR = 12; // TD_WCHAR = 12,
30 const uint16_t VTYPE_VOID = 13; // TD_VOID = 13,
31 const uint16_t VTYPE_ID = 14; // TD_PNSIID = 14,
32 const uint16_t VTYPE_DOMSTRING = 15; // TD_DOMSTRING = 15,
33 const uint16_t VTYPE_CHAR_STR = 16; // TD_PSTRING = 16,
34 const uint16_t VTYPE_WCHAR_STR = 17; // TD_PWSTRING = 17,
35 const uint16_t VTYPE_INTERFACE = 18; // TD_INTERFACE_TYPE = 18,
36 const uint16_t VTYPE_INTERFACE_IS = 19; // TD_INTERFACE_IS_TYPE = 19,
37 const uint16_t VTYPE_ARRAY = 20; // TD_ARRAY = 20,
38 const uint16_t VTYPE_STRING_SIZE_IS = 21; // TD_PSTRING_SIZE_IS = 21,
39 const uint16_t VTYPE_WSTRING_SIZE_IS = 22; // TD_PWSTRING_SIZE_IS = 22,
40 const uint16_t VTYPE_UTF8STRING = 23; // TD_UTF8STRING = 23,
41 const uint16_t VTYPE_CSTRING = 24; // TD_CSTRING = 24,
42 const uint16_t VTYPE_ASTRING = 25; // TD_ASTRING = 25,
43 const uint16_t VTYPE_EMPTY_ARRAY = 254;
44 const uint16_t VTYPE_EMPTY = 255;
47 /**
48 * XPConnect has magic to transparently convert between nsIVariant and JS types.
49 * We mark the interface [scriptable] so that JS can use methods
50 * that refer to this interface. But we mark all the methods and attributes
51 * [noscript] since any nsIVariant object will be automatically converted to a
52 * JS type anyway.
55 [scriptable, uuid(81e4c2de-acac-4ad6-901a-b5fb1b851a0d)]
56 interface nsIVariant : nsISupports
58 [noscript] readonly attribute uint16_t dataType;
60 [noscript] uint8_t getAsInt8();
61 [noscript] int16_t getAsInt16();
62 [noscript] int32_t getAsInt32();
63 [noscript] int64_t getAsInt64();
64 [noscript] uint8_t getAsUint8();
65 [noscript] uint16_t getAsUint16();
66 [noscript] uint32_t getAsUint32();
67 [noscript] uint64_t getAsUint64();
68 [noscript] float getAsFloat();
69 [noscript] double getAsDouble();
70 [noscript] boolean getAsBool();
71 [noscript] char getAsChar();
72 [noscript] wchar getAsWChar();
73 [notxpcom] nsresult getAsID(out nsID retval);
74 [noscript] AString getAsAString();
75 [noscript] DOMString getAsDOMString();
76 [noscript] ACString getAsACString();
77 [noscript] AUTF8String getAsAUTF8String();
78 [noscript] string getAsString();
79 [noscript] wstring getAsWString();
80 [noscript] nsISupports getAsISupports();
81 [noscript] jsval getAsJSVal();
83 [noscript] void getAsInterface(out nsIIDPtr iid,
84 [iid_is(iid), retval] out nsQIResult iface);
86 [notxpcom] nsresult getAsArray(out uint16_t type, out nsIID iid,
87 out uint32_t count, out voidPtr ptr);
89 [noscript] void getAsStringWithSize(out uint32_t size,
90 [size_is(size), retval] out string str);
92 [noscript] void getAsWStringWithSize(out uint32_t size,
93 [size_is(size), retval] out wstring str);
96 /**
97 * An object that implements nsIVariant may or may NOT also implement this
98 * nsIWritableVariant.
100 * If the 'writable' attribute is false then attempts to call any of the 'set'
101 * methods can be expected to fail. Setting the 'writable' attribute may or
102 * may not succeed.
106 [scriptable, uuid(5586a590-8c82-11d5-90f3-0010a4e73d9a)]
107 interface nsIWritableVariant : nsIVariant
109 attribute boolean writable;
111 void setAsInt8(in uint8_t aValue);
112 void setAsInt16(in int16_t aValue);
113 void setAsInt32(in int32_t aValue);
114 void setAsInt64(in int64_t aValue);
115 void setAsUint8(in uint8_t aValue);
116 void setAsUint16(in uint16_t aValue);
117 void setAsUint32(in uint32_t aValue);
118 void setAsUint64(in uint64_t aValue);
119 void setAsFloat(in float aValue);
120 void setAsDouble(in double aValue);
121 void setAsBool(in boolean aValue);
122 void setAsChar(in char aValue);
123 void setAsWChar(in wchar aValue);
124 void setAsID(in nsIDRef aValue);
125 void setAsAString(in AString aValue);
126 void setAsDOMString(in DOMString aValue);
127 void setAsACString(in ACString aValue);
128 void setAsAUTF8String(in AUTF8String aValue);
129 void setAsString(in string aValue);
130 void setAsWString(in wstring aValue);
131 void setAsISupports(in nsISupports aValue);
133 void setAsInterface(in nsIIDRef iid,
134 [iid_is(iid)] in nsQIResult iface);
136 [noscript] void setAsArray(in uint16_t type, in nsIIDPtr iid,
137 in uint32_t count, in voidPtr ptr);
139 void setAsStringWithSize(in uint32_t size,
140 [size_is(size)] in string str);
142 void setAsWStringWithSize(in uint32_t size,
143 [size_is(size)] in wstring str);
145 void setAsVoid();
146 void setAsEmpty();
147 void setAsEmptyArray();
149 void setFromVariant(in nsIVariant aValue);
152 %{C++
153 // The contractID for the generic implementation built in to xpcom.
154 #define NS_VARIANT_CONTRACTID "@mozilla.org/variant;1"