nsIVariant
and JS types. We mark the interface [scriptable] so that JS can use methods that refer to this interface. But we mark all the methods and attributes [noscript] since any nsIVariant
object will be automatically converted to a JS type anyway.
nsISupports
Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)ACString getAsACString(); Native code only! |
nsresult getAsArray(out PRUint16 type, out nsIID iid, out PRUint32 count, out voidPtr ptr); Violates the XPCOM interface guidelines |
AString getAsAString(); Native code only! |
AUTF8String getAsAUTF8String(); Native code only! |
PRBool getAsBool(); Native code only! |
char getAsChar(); Native code only! |
DOMString getAsDOMString(); Native code only! |
double getAsDouble(); Native code only! |
float getAsFloat(); Native code only! |
nsresult getAsID(out nsID retval); Violates the XPCOM interface guidelines |
PRInt16 getAsInt16(); Native code only! |
PRInt32 getAsInt32(); Native code only! |
PRInt64 getAsInt64(); Native code only! |
PRUint8 getAsInt8(); Native code only! |
void getAsInterface(out nsIIDPtr iid, [iid_is(iid), retval] out nsQIResult iface); Native code only! |
nsISupports getAsISupports(); Native code only! |
jsval getAsJSVal(); Native code only! |
string getAsString(); Native code only! |
void getAsStringWithSize(out PRUint32 size, [size_is(size), retval] out string str); Native code only! |
PRUint16 getAsUint16(); Native code only! |
PRUint32 getAsUint32(); Native code only! |
PRUint64 getAsUint64(); Native code only! |
PRUint8 getAsUint8(); Native code only! |
wchar getAsWChar(); Native code only! |
wstring getAsWString(); Native code only! |
void getAsWStringWithSize(out PRUint32 size, [size_is(size), retval] out wstring str); Native code only! |
Attribute | Type | Description |
dataType |
PRUint16 |
Read only. Native code only! |
ACString getAsACString();
None.
The value is converted to an 8-bit string in the ISO-8859-1 character set. If the value was UTF16 then the high bits are lost. If the value was UTF8 then it is converted to UTF16 and the high bits are discarded. Arrays and interface pointers cannot be converted to a string.
nsresult getAsArray( out PRUint16 type, out nsIID iid, out PRUint32 count, out voidPtr ptr );
type
iid
count
ptr
AString getAsAString();
None.
The internal value is converted to a UTF16 string. Arrays and interface pointers cannot be converted to a string.
AUTF8String getAsAUTF8String();
None.
The internal value is converted to a UTF8 string. An ISO-8859-1 string is widened to a UTF16 string first. Arrays and interface pointers cannot be converted to a string.
PRBool getAsBool();
None.
If possible, the internal value is converted to a double, which is then compared to zero.
char getAsChar();
None.
If the internal value is a string, it is first converted to a double, if possible. If it is of a numeric type, it is cast directly to char.
DOMString getAsDOMString();
None.
This returns the same as the getAsAString method.
double getAsDouble();
None.
If the internal value is a string, it is converted to a double, if possible. If it is of a numeric type it is cast directly to double.
float getAsFloat();
None.
If the internal value is a string, it is first converted to a double, if possible. If it is of a numeric type, it is cast directly to float.
nsresult getAsID( out nsID retval );
retval
If the conversion succeeds, NS_OK is returned, otherwise NS_ERROR_CANNOT_CONVERT_DATA is returned.
PRInt16 getAsInt16();
None.
If the internal value is a string, it is first converted to a double, if possible. If it within the numeric limits of a PRInt16 then the value is returned.
PRInt32 getAsInt32();
None.
If the internal value is a string, it is first converted to a double, if possible. If it within the numeric limits of a PRInt32 then the value is returned.
PRInt64 getAsInt64();
None.
If the internal value is a string, it is first converted to a double, if possible. If it is of a numeric type, it is cast directly to PRInt64.
PRUint8 getAsInt8();
None.
If the internal value is a string, it is first converted to a double, if possible. If it within the numeric limits of a PRInt8 then the value is returned.
void getAsInterface( out nsIIDPtr iid, [iid_is(iid), retval] out nsQIResult iface );
iid
iface
nsISupports getAsISupports();
None.
The interface pointer. (The reference count of the object is incremented.)
jsval getAsJSVal();
None.
Returns the underlying JS value, if the variant was created by passing a JS object into XPConnect.
string getAsString();
None.
The value is converted to an 8-bit string in the ISO-8859-1 character set. If the value was UTF16 then the high bits are lost. If the value was UTF8 then it is converted to UTF16 and the high bits are discarded. Arrays and interface pointers cannot be converted to a string.
void getAsStringWithSize( out PRUint32 size, [size_is(size), retval] out string str );
size
str
PRUint16 getAsUint16();
None.
If the internal value is a string, it is first converted to a double, if possible. If it within the numeric limits of a PRUint16 then the value is returned.
PRUint32 getAsUint32();
None.
If the internal value is a string, it is first converted to a double, if possible. If it within the numeric limits of a PRUint64 then the value is returned.
PRUint64 getAsUint64();
None.
If the internal value is a string, it is first converted to a double, if possible. If it is of a numeric type, it is cast to PRInt64 and then to PRUint64. Note that this will do strange things with negative numbers, and float and double values greater than the numeric limits of a PRInt64 will not convert correctly.
PRUint8 getAsUint8();
None.
If the internal value is a string, it is first converted to a double, if possible. If it within the numeric limits of a PRUint8 then the value is returned.
wchar getAsWChar();
None.
If the internal value is a string, it is first converted to a double, if possible. If it is of a numeric type, it is cast directly to PRUnichar.
wstring getAsWString();
None.
The internal value is converted to a UTF16 string. Arrays and interface pointers cannot be converted to a string.
void getAsWStringWithSize( out PRUint32 size, [size_is(size), retval] out wstring str );
size
str