VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/xpcom/ds/nsIVariant.idl@ 4837

Last change on this file since 4837 was 1, checked in by vboxsync, 54 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.2 KB
Line 
1/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * The Original Code is mozilla.org code.
17 *
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 1998
21 * the Initial Developer. All Rights Reserved.
22 *
23 * Contributor(s):
24 * John Bandhauer <jband@netscape.com>
25 *
26 * Alternatively, the contents of this file may be used under the terms of
27 * either of the GNU General Public License Version 2 or later (the "GPL"),
28 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
37 *
38 * ***** END LICENSE BLOCK ***** */
39
40/* The long avoided variant support for xpcom. */
41
42#include "nsISupports.idl"
43
44[scriptable,uuid(4d12e540-83d7-11d5-90ed-0010a4e73d9a)]
45interface nsIDataType : nsISupports
46{
47 // These MUST match the declarations in xpt_struct.h.
48 // Otherwise the world is likely to explode.
49 // From xpt_struct.h ...
50 const PRUint16 VTYPE_INT8 = 0; // TD_INT8 = 0,
51 const PRUint16 VTYPE_INT16 = 1; // TD_INT16 = 1,
52 const PRUint16 VTYPE_INT32 = 2; // TD_INT32 = 2,
53 const PRUint16 VTYPE_INT64 = 3; // TD_INT64 = 3,
54 const PRUint16 VTYPE_UINT8 = 4; // TD_UINT8 = 4,
55 const PRUint16 VTYPE_UINT16 = 5; // TD_UINT16 = 5,
56 const PRUint16 VTYPE_UINT32 = 6; // TD_UINT32 = 6,
57 const PRUint16 VTYPE_UINT64 = 7; // TD_UINT64 = 7,
58 const PRUint16 VTYPE_FLOAT = 8; // TD_FLOAT = 8,
59 const PRUint16 VTYPE_DOUBLE = 9; // TD_DOUBLE = 9,
60 const PRUint16 VTYPE_BOOL = 10; // TD_BOOL = 10,
61 const PRUint16 VTYPE_CHAR = 11; // TD_CHAR = 11,
62 const PRUint16 VTYPE_WCHAR = 12; // TD_WCHAR = 12,
63 const PRUint16 VTYPE_VOID = 13; // TD_VOID = 13,
64 const PRUint16 VTYPE_ID = 14; // TD_PNSIID = 14,
65 const PRUint16 VTYPE_DOMSTRING = 15; // TD_DOMSTRING = 15,
66 const PRUint16 VTYPE_CHAR_STR = 16; // TD_PSTRING = 16,
67 const PRUint16 VTYPE_WCHAR_STR = 17; // TD_PWSTRING = 17,
68 const PRUint16 VTYPE_INTERFACE = 18; // TD_INTERFACE_TYPE = 18,
69 const PRUint16 VTYPE_INTERFACE_IS = 19; // TD_INTERFACE_IS_TYPE = 19,
70 const PRUint16 VTYPE_ARRAY = 20; // TD_ARRAY = 20,
71 const PRUint16 VTYPE_STRING_SIZE_IS = 21; // TD_PSTRING_SIZE_IS = 21,
72 const PRUint16 VTYPE_WSTRING_SIZE_IS = 22; // TD_PWSTRING_SIZE_IS = 22,
73 const PRUint16 VTYPE_UTF8STRING = 23; // TD_UTF8STRING = 23,
74 const PRUint16 VTYPE_CSTRING = 24; // TD_CSTRING = 24,
75 const PRUint16 VTYPE_ASTRING = 25; // TD_ASTRING = 25,
76 const PRUint16 VTYPE_EMPTY_ARRAY = 254;
77 const PRUint16 VTYPE_EMPTY = 255;
78};
79
80
81/**
82 * XPConnect has magic to transparently convert between nsIVariant and JS types.
83 * We mark the interface [scriptable] so that JS can use methods
84 * that refer to this interface. But we mark all the methods and attributes
85 * [noscript] since any nsIVariant object will be automatically converted to a
86 * JS type anyway.
87 */
88
89[scriptable, uuid(6c9eb060-8c6a-11d5-90f3-0010a4e73d9a)]
90interface nsIVariant : nsISupports
91{
92 [noscript] readonly attribute PRUint16 dataType;
93
94 [noscript] PRUint8 getAsInt8();
95 [noscript] PRInt16 getAsInt16();
96 [noscript] PRInt32 getAsInt32();
97 [noscript] PRInt64 getAsInt64();
98 [noscript] PRUint8 getAsUint8();
99 [noscript] PRUint16 getAsUint16();
100 [noscript] PRUint32 getAsUint32();
101 [noscript] PRUint64 getAsUint64();
102 [noscript] float getAsFloat();
103 [noscript] double getAsDouble();
104 [noscript] PRBool getAsBool();
105 [noscript] char getAsChar();
106 [noscript] wchar getAsWChar();
107 [notxpcom] nsresult getAsID(out nsID retval);
108 [noscript] AString getAsAString();
109 [noscript] DOMString getAsDOMString();
110 [noscript] ACString getAsACString();
111 [noscript] AUTF8String getAsAUTF8String();
112 [noscript] string getAsString();
113 [noscript] wstring getAsWString();
114 [noscript] nsISupports getAsISupports();
115
116 [noscript] void getAsInterface(out nsIIDPtr iid,
117 [iid_is(iid), retval] out nsQIResult iface);
118
119 [notxpcom] nsresult getAsArray(out PRUint16 type, out nsIID iid,
120 out PRUint32 count, out voidPtr ptr);
121
122 [noscript] void getAsStringWithSize(out PRUint32 size,
123 [size_is(size), retval] out string str);
124
125 [noscript] void getAsWStringWithSize(out PRUint32 size,
126 [size_is(size), retval] out wstring str);
127};
128
129/**
130 * An object that implements nsIVariant may or may NOT also implement this
131 * nsIWritableVariant.
132 *
133 * If the 'writable' attribute is false then attempts to call any of the 'set'
134 * methods can be expected to fail. Setting the 'writable' attribute may or
135 * may not succeed.
136 *
137 */
138
139[scriptable, uuid(5586a590-8c82-11d5-90f3-0010a4e73d9a)]
140interface nsIWritableVariant : nsIVariant
141{
142 attribute PRBool writable;
143
144 void setAsInt8(in PRUint8 aValue);
145 void setAsInt16(in PRInt16 aValue);
146 void setAsInt32(in PRInt32 aValue);
147 void setAsInt64(in PRInt64 aValue);
148 void setAsUint8(in PRUint8 aValue);
149 void setAsUint16(in PRUint16 aValue);
150 void setAsUint32(in PRUint32 aValue);
151 void setAsUint64(in PRUint64 aValue);
152 void setAsFloat(in float aValue);
153 void setAsDouble(in double aValue);
154 void setAsBool(in PRBool aValue);
155 void setAsChar(in char aValue);
156 void setAsWChar(in wchar aValue);
157 void setAsID(in nsIDRef aValue);
158 void setAsAString(in AString aValue);
159 void setAsDOMString(in DOMString aValue);
160 void setAsACString(in ACString aValue);
161 void setAsAUTF8String(in AUTF8String aValue);
162 void setAsString(in string aValue);
163 void setAsWString(in wstring aValue);
164 void setAsISupports(in nsISupports aValue);
165
166 void setAsInterface(in nsIIDRef iid,
167 [iid_is(iid)] in nsQIResult iface);
168
169 [noscript] void setAsArray(in PRUint16 type, in nsIIDPtr iid,
170 in PRUint32 count, in voidPtr ptr);
171
172 void setAsStringWithSize(in PRUint32 size,
173 [size_is(size)] in string str);
174
175 void setAsWStringWithSize(in PRUint32 size,
176 [size_is(size)] in wstring str);
177
178 void setAsVoid();
179 void setAsEmpty();
180 void setAsEmptyArray();
181
182 void setFromVariant(in nsIVariant aValue);
183};
184
185%{C++
186// The contractID for the generic implementation built in to xpcom.
187#define NS_VARIANT_CONTRACTID "@mozilla.org/variant;1"
188%}
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use