Fix for bug 125465. r=jag, sr=jband, a=asa. Add AString, ACString, and AUTF8String support to XPCOM's variant data type. Also, add forward declarations of AString and ACString to nsrootidl.idl.
git-svn-id: svn://10.0.0.236/trunk@115789 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -46,6 +46,12 @@
|
||||
#include "nscore.h"
|
||||
#include "prtime.h"
|
||||
|
||||
/*
|
||||
* Forward declarations for new string types
|
||||
*/
|
||||
class nsAString;
|
||||
class nsACString;
|
||||
|
||||
/*
|
||||
* Start commenting out the C++ versions of the below in the output header
|
||||
*/
|
||||
|
||||
@@ -34,7 +34,7 @@ interface nsIDataType : nsISupports
|
||||
{
|
||||
// These MUST match the declarations in xpt_struct.h.
|
||||
// Otherwise the world is likely to explode.
|
||||
// From xpt_struct.h ...
|
||||
// From xpt_struct.h ...
|
||||
const PRUint16 VTYPE_INT8 = 0; // TD_INT8 = 0,
|
||||
const PRUint16 VTYPE_INT16 = 1; // TD_INT16 = 1,
|
||||
const PRUint16 VTYPE_INT32 = 2; // TD_INT32 = 2,
|
||||
@@ -50,15 +50,17 @@ interface nsIDataType : nsISupports
|
||||
const PRUint16 VTYPE_WCHAR = 12; // TD_WCHAR = 12,
|
||||
const PRUint16 VTYPE_VOID = 13; // TD_VOID = 13,
|
||||
const PRUint16 VTYPE_ID = 14; // TD_PNSIID = 14,
|
||||
const PRUint16 VTYPE_ASTRING = 15; // TD_DOMSTRING = 15,
|
||||
const PRUint16 VTYPE_DOMSTRING = 15; // TD_DOMSTRING = 15,
|
||||
const PRUint16 VTYPE_CHAR_STR = 16; // TD_PSTRING = 16,
|
||||
const PRUint16 VTYPE_WCHAR_STR = 17; // TD_PWSTRING = 17,
|
||||
const PRUint16 VTYPE_INTERFACE = 18; // TD_INTERFACE_TYPE = 18,
|
||||
const PRUint16 VTYPE_INTERFACE_IS = 19; // TD_INTERFACE_IS_TYPE = 19,
|
||||
const PRUint16 VTYPE_ARRAY = 20; // TD_ARRAY = 20,
|
||||
const PRUint16 VTYPE_STRING_SIZE_IS = 21; // TD_PSTRING_SIZE_IS = 21,
|
||||
const PRUint16 VTYPE_WSTRING_SIZE_IS = 22; // TD_PWSTRING_SIZE_IS = 22
|
||||
|
||||
const PRUint16 VTYPE_WSTRING_SIZE_IS = 22; // TD_PWSTRING_SIZE_IS = 22,
|
||||
const PRUint16 VTYPE_UTF8STRING = 23; // TD_UTF8STRING = 23,
|
||||
const PRUint16 VTYPE_CSTRING = 24; // TD_CSTRING = 24,
|
||||
const PRUint16 VTYPE_ASTRING = 25; // TD_ASTRING = 25,
|
||||
const PRUint16 VTYPE_EMPTY = 255;
|
||||
};
|
||||
|
||||
@@ -91,6 +93,9 @@ interface nsIVariant : nsISupports
|
||||
[noscript] wchar getAsWChar();
|
||||
[notxpcom] nsresult getAsID(out nsID retval);
|
||||
[noscript] AString getAsAString();
|
||||
[noscript] DOMString getAsDOMString();
|
||||
[noscript] ACString getAsACString();
|
||||
[noscript] AUTF8String getAsAUTF8String();
|
||||
[noscript] string getAsString();
|
||||
[noscript] wstring getAsWString();
|
||||
[noscript] nsISupports getAsISupports();
|
||||
@@ -138,6 +143,9 @@ interface nsIWritableVariant : nsIVariant
|
||||
void setAsWChar(in wchar aValue);
|
||||
void setAsID(in nsIDRef aValue);
|
||||
void setAsAString(in AString aValue);
|
||||
void setAsDOMString(in DOMString aValue);
|
||||
void setAsACString(in ACString aValue);
|
||||
void setAsAUTF8String(in AUTF8String aValue);
|
||||
void setAsString(in string aValue);
|
||||
void setAsWString(in wstring aValue);
|
||||
void setAsISupports(in nsISupports aValue);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -26,6 +26,15 @@
|
||||
#include "nsIVariant.h"
|
||||
#include "xpt_struct.h"
|
||||
|
||||
/**
|
||||
* 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 type that nsIVariant implementors *may* use
|
||||
* to hold underlying data. It has no methods. So, its use requires no linkage
|
||||
@@ -35,21 +44,23 @@
|
||||
struct NS_COM nsDiscriminatedUnion
|
||||
{
|
||||
union {
|
||||
PRInt8 mInt8Value;
|
||||
PRInt16 mInt16Value;
|
||||
PRInt32 mInt32Value;
|
||||
PRInt64 mInt64Value;
|
||||
PRUint8 mUint8Value;
|
||||
PRUint16 mUint16Value;
|
||||
PRUint32 mUint32Value;
|
||||
PRUint64 mUint64Value;
|
||||
float mFloatValue;
|
||||
double mDoubleValue;
|
||||
PRBool mBoolValue;
|
||||
char mCharValue;
|
||||
PRUnichar mWCharValue;
|
||||
nsIID mIDValue;
|
||||
nsAString* mAStringValue;
|
||||
PRInt8 mInt8Value;
|
||||
PRInt16 mInt16Value;
|
||||
PRInt32 mInt32Value;
|
||||
PRInt64 mInt64Value;
|
||||
PRUint8 mUint8Value;
|
||||
PRUint16 mUint16Value;
|
||||
PRUint32 mUint32Value;
|
||||
PRUint64 mUint64Value;
|
||||
float mFloatValue;
|
||||
double mDoubleValue;
|
||||
PRBool mBoolValue;
|
||||
char mCharValue;
|
||||
PRUnichar mWCharValue;
|
||||
nsIID mIDValue;
|
||||
nsAString* mAStringValue;
|
||||
nsAUTF8String* mUTF8StringValue;
|
||||
nsACString* mCStringValue;
|
||||
struct {
|
||||
nsISupports* mInterfaceValue;
|
||||
nsIID mInterfaceID;
|
||||
@@ -111,6 +122,8 @@ public:
|
||||
static nsresult ConvertToWChar(const nsDiscriminatedUnion& data, PRUnichar *_retval);
|
||||
static nsresult ConvertToID(const nsDiscriminatedUnion& data, nsID * _retval);
|
||||
static nsresult ConvertToAString(const nsDiscriminatedUnion& data, nsAWritableString & _retval);
|
||||
static nsresult ConvertToAUTF8String(const nsDiscriminatedUnion& data, nsAUTF8String & _retval);
|
||||
static nsresult ConvertToACString(const nsDiscriminatedUnion& data, nsACString & _retval);
|
||||
static nsresult ConvertToString(const nsDiscriminatedUnion& data, char **_retval);
|
||||
static nsresult ConvertToWString(const nsDiscriminatedUnion& data, PRUnichar **_retval);
|
||||
static nsresult ConvertToISupports(const nsDiscriminatedUnion& data, nsISupports **_retval);
|
||||
@@ -136,6 +149,8 @@ public:
|
||||
static nsresult SetFromWChar(nsDiscriminatedUnion* data, PRUnichar aValue);
|
||||
static nsresult SetFromID(nsDiscriminatedUnion* data, const nsID & aValue);
|
||||
static nsresult SetFromAString(nsDiscriminatedUnion* data, const nsAReadableString & aValue);
|
||||
static nsresult SetFromAUTF8String(nsDiscriminatedUnion* data, const nsAUTF8String & aValue);
|
||||
static nsresult SetFromACString(nsDiscriminatedUnion* data, const nsACString & aValue);
|
||||
static nsresult SetFromString(nsDiscriminatedUnion* data, const char *aValue);
|
||||
static nsresult SetFromWString(nsDiscriminatedUnion* data, const PRUnichar *aValue);
|
||||
static nsresult SetFromISupports(nsDiscriminatedUnion* data, nsISupports *aValue);
|
||||
|
||||
Reference in New Issue
Block a user