Back to index

lightning-sunbird  0.9+nobinonly
nsIVariant.idl
Go to the documentation of this file.
00001 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is mozilla.org code.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1998
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   John Bandhauer <jband@netscape.com>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either of the GNU General Public License Version 2 or later (the "GPL"),
00028  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 /* The long avoided variant support for xpcom. */
00041 
00042 #include "nsISupports.idl"
00043 
00044 [scriptable,uuid(4d12e540-83d7-11d5-90ed-0010a4e73d9a)]
00045 interface nsIDataType : nsISupports
00046 {
00047     // These MUST match the declarations in xpt_struct.h. 
00048     // Otherwise the world is likely to explode.   
00049                                                    // From xpt_struct.h ...
00050     const PRUint16 VTYPE_INT8                =  0; // TD_INT8              = 0,
00051     const PRUint16 VTYPE_INT16               =  1; // TD_INT16             = 1,
00052     const PRUint16 VTYPE_INT32               =  2; // TD_INT32             = 2,
00053     const PRUint16 VTYPE_INT64               =  3; // TD_INT64             = 3,
00054     const PRUint16 VTYPE_UINT8               =  4; // TD_UINT8             = 4,
00055     const PRUint16 VTYPE_UINT16              =  5; // TD_UINT16            = 5,
00056     const PRUint16 VTYPE_UINT32              =  6; // TD_UINT32            = 6,
00057     const PRUint16 VTYPE_UINT64              =  7; // TD_UINT64            = 7,
00058     const PRUint16 VTYPE_FLOAT               =  8; // TD_FLOAT             = 8, 
00059     const PRUint16 VTYPE_DOUBLE              =  9; // TD_DOUBLE            = 9,
00060     const PRUint16 VTYPE_BOOL                = 10; // TD_BOOL              = 10,
00061     const PRUint16 VTYPE_CHAR                = 11; // TD_CHAR              = 11,
00062     const PRUint16 VTYPE_WCHAR               = 12; // TD_WCHAR             = 12,
00063     const PRUint16 VTYPE_VOID                = 13; // TD_VOID              = 13,
00064     const PRUint16 VTYPE_ID                  = 14; // TD_PNSIID            = 14,
00065     const PRUint16 VTYPE_DOMSTRING           = 15; // TD_DOMSTRING         = 15,
00066     const PRUint16 VTYPE_CHAR_STR            = 16; // TD_PSTRING           = 16,
00067     const PRUint16 VTYPE_WCHAR_STR           = 17; // TD_PWSTRING          = 17,
00068     const PRUint16 VTYPE_INTERFACE           = 18; // TD_INTERFACE_TYPE    = 18,
00069     const PRUint16 VTYPE_INTERFACE_IS        = 19; // TD_INTERFACE_IS_TYPE = 19,
00070     const PRUint16 VTYPE_ARRAY               = 20; // TD_ARRAY             = 20,
00071     const PRUint16 VTYPE_STRING_SIZE_IS      = 21; // TD_PSTRING_SIZE_IS   = 21,
00072     const PRUint16 VTYPE_WSTRING_SIZE_IS     = 22; // TD_PWSTRING_SIZE_IS  = 22,
00073     const PRUint16 VTYPE_UTF8STRING          = 23; // TD_UTF8STRING        = 23,
00074     const PRUint16 VTYPE_CSTRING             = 24; // TD_CSTRING           = 24,
00075     const PRUint16 VTYPE_ASTRING             = 25; // TD_ASTRING           = 25,
00076     const PRUint16 VTYPE_EMPTY_ARRAY         = 254;
00077     const PRUint16 VTYPE_EMPTY               = 255;
00078 };
00079 
00080 
00089 [scriptable, uuid(6c9eb060-8c6a-11d5-90f3-0010a4e73d9a)]
00090 interface nsIVariant : nsISupports
00091 {
00092     [noscript] readonly attribute PRUint16     dataType;
00093 
00094     [noscript] PRUint8      getAsInt8();
00095     [noscript] PRInt16      getAsInt16();
00096     [noscript] PRInt32      getAsInt32();
00097     [noscript] PRInt64      getAsInt64();
00098     [noscript] PRUint8      getAsUint8();
00099     [noscript] PRUint16     getAsUint16();
00100     [noscript] PRUint32     getAsUint32();
00101     [noscript] PRUint64     getAsUint64();
00102     [noscript] float        getAsFloat();
00103     [noscript] double       getAsDouble();
00104     [noscript] PRBool       getAsBool();
00105     [noscript] char         getAsChar();
00106     [noscript] wchar        getAsWChar();
00107     [notxpcom] nsresult     getAsID(out nsID retval);
00108     [noscript] AString      getAsAString();
00109     [noscript] DOMString    getAsDOMString();
00110     [noscript] ACString     getAsACString();
00111     [noscript] AUTF8String  getAsAUTF8String();
00112     [noscript] string       getAsString();
00113     [noscript] wstring      getAsWString();
00114     [noscript] nsISupports  getAsISupports();
00115 
00116     [noscript] void getAsInterface(out nsIIDPtr iid, 
00117                                    [iid_is(iid), retval] out nsQIResult iface);
00118 
00119     [notxpcom] nsresult getAsArray(out PRUint16 type, out nsIID iid,
00120                                    out PRUint32 count, out voidPtr ptr);
00121 
00122     [noscript] void getAsStringWithSize(out PRUint32 size, 
00123                                         [size_is(size), retval] out string str);
00124     
00125     [noscript] void getAsWStringWithSize(out PRUint32 size, 
00126                                          [size_is(size), retval] out wstring str);
00127 };
00128 
00139 [scriptable, uuid(5586a590-8c82-11d5-90f3-0010a4e73d9a)]
00140 interface nsIWritableVariant : nsIVariant
00141 {
00142     attribute PRBool writable;
00143 
00144     void setAsInt8(in PRUint8 aValue);
00145     void setAsInt16(in PRInt16 aValue);
00146     void setAsInt32(in PRInt32 aValue);
00147     void setAsInt64(in PRInt64 aValue);
00148     void setAsUint8(in PRUint8 aValue);
00149     void setAsUint16(in PRUint16 aValue);
00150     void setAsUint32(in PRUint32 aValue);
00151     void setAsUint64(in PRUint64 aValue);
00152     void setAsFloat(in float aValue);
00153     void setAsDouble(in double aValue);
00154     void setAsBool(in PRBool aValue);
00155     void setAsChar(in char aValue);
00156     void setAsWChar(in wchar aValue);
00157     void setAsID(in nsIDRef aValue);
00158     void setAsAString(in AString aValue);
00159     void setAsDOMString(in DOMString aValue);
00160     void setAsACString(in ACString aValue);
00161     void setAsAUTF8String(in AUTF8String aValue);
00162     void setAsString(in string aValue);
00163     void setAsWString(in wstring aValue);
00164     void setAsISupports(in nsISupports aValue);
00165 
00166     void setAsInterface(in nsIIDRef iid, 
00167                         [iid_is(iid)] in nsQIResult iface);
00168 
00169     [noscript] void setAsArray(in PRUint16 type, in nsIIDPtr iid,
00170                                in PRUint32 count, in voidPtr ptr);
00171 
00172     void setAsStringWithSize(in PRUint32 size, 
00173                              [size_is(size)] in string str);
00174     
00175     void setAsWStringWithSize(in PRUint32 size, 
00176                               [size_is(size)] in wstring str);
00177 
00178     void setAsVoid();
00179     void setAsEmpty();
00180     void setAsEmptyArray();
00181 
00182     void setFromVariant(in nsIVariant aValue);
00183 };
00184 
00185 %{C++
00186 // The contractID for the generic implementation built in to xpcom.
00187 #define NS_VARIANT_CONTRACTID "@mozilla.org/variant;1"
00188 %}