#include <GVariant.h>
Inherited by GNamedVariant.
Public Member Functions | |
GVariant () | |
Constructor to null. | |
GVariant (int i) | |
Constructor for int. | |
GVariant (int64 i) | |
Constructor for int. | |
GVariant (double i) | |
Constructor for double. | |
GVariant (const char *s) | |
Constructor for string. | |
GVariant (const char16 *s) | |
Constructor for wide string. | |
GVariant (void *p) | |
Constructor for ptr. | |
GVariant (GDom *p) | |
Constructor for DOM ptr. | |
GVariant (GDom *p, char *name) | |
Constructor for DOM variable reference. | |
GVariant (GDateTime *d) | |
Constructor for date. | |
GVariant (GVariant const &v) | |
Constructor for variant. | |
GVariant (GOperator Op) | |
Construtor for operator. | |
~GVariant () | |
Destructor. | |
GVariant & | operator= (int i) |
Assign int value. | |
GVariant & | operator= (bool i) |
Assign bool value. | |
GVariant & | operator= (int64 i) |
Assign int value. | |
GVariant & | operator= (double i) |
Assign double value. | |
GVariant & | operator= (const char *s) |
Assign string value (makes a copy). | |
GVariant & | operator= (const char16 *s) |
Assign a wide string value (makes a copy). | |
GVariant & | operator= (GVariant const &i) |
Assign another variant value. | |
GVariant & | operator= (void *p) |
Assign value to a void ptr. | |
GVariant & | operator= (GDom *p) |
Assign value to DOM ptr. | |
GVariant & | operator= (GDateTime *d) |
Assign value to be a date/time. | |
bool | SetDomRef (GDom *obj, char *name) |
Sets the value to a DOM variable reference. | |
bool | SetBinary (int Len, void *Data, bool Own=false) |
Sets the value to a copy of block of binary data. | |
bool | SetList (List< GVariant > *Lst=0) |
Sets the value to a copy of the list. | |
bool | SetHashTable (GHashTable *Table=0, bool Copy=true) |
Sets the value to a hashtable. | |
char * | Str () |
Returns the string if valid (will convert a GV_WSTRING to utf). | |
char16 * | WStr () |
Returns a wide string if valid (will convert a GV_STRING to wide). | |
char * | ReleaseStr () |
char16 * | ReleaseWStr () |
void | OwnStr (char *s) |
Sets the variant to a heap string and takes ownership of it. | |
void | OwnStr (char16 *s) |
Sets the variant to a wide heap string and takes ownership of it. | |
void | Empty () |
Sets the variant to NULL. | |
bool | IsInt () |
True if currently a int. | |
bool | IsBool () |
True if currently a bool. | |
bool | IsDouble () |
True if currently a double. | |
bool | IsString () |
True if currently a string. | |
bool | IsBinary () |
True if currently a binary block. | |
bool | IsNull () |
True if currently null. | |
GVariant & | Cast (GVariantType NewType) |
int32 | CastInt32 () |
int64 | CastInt64 () |
double | CastDouble () |
char * | CastString () |
GDom * | CastDom () |
Casts to a DOM ptr. | |
bool | CastBool () |
Casts to a boolean. | |
void * | CastVoidPtr () |
Returns the pointer if available. | |
Public Attributes | |
GVariantType | Type |
The type of the variant. | |
uint32 | User |
User data. | |
union { | |
int Int | |
Valid when Type == GV_INT32. | |
bool Bool | |
Valid when Type == GV_BOOL. | |
int64 Int64 | |
Valid when Type == GV_INT64. | |
double Dbl | |
Valid when Type == GV_DOUBLE. | |
char * String | |
Valid when Type == GV_STRING. | |
char16 * WString | |
Valid when Type == GV_WSTRING. | |
GDom * Dom | |
Valid when Type == GV_DOM. | |
void * Ptr | |
Valid when Type is GV_VOID_PTR, GV_GVIEW, GV_GMOUSE or GV_GKEY. | |
struct _Binary { | |
} Binary | |
Valid when Type == GV_BINARY. | |
List< GVariant > * Lst | |
Valid when Type == GV_LIST. | |
GHashTable * Hash | |
Valid when Type == GV_HASHTABLE. | |
GDateTime * Date | |
Valid when Type == GV_DATETIME. | |
struct _Custom { | |
} Custom | |
Valid when Type == GV_CUSTOM. | |
struct _DomRef { | |
GDom * Dom | |
The pointer to the dom object. | |
char * Name | |
The name of the variable to set/get in the dom object. | |
} DomRef | |
Valid when Type == GV_DOMREF. | |
GOperator Op | |
Valid when Type == GV_OPERATOR. | |
class GSurface * Surface | |
Valid when Type == GV_GSURFACE. | |
class GView * View | |
Valid when Type == GV_GVIEW. | |
class GMouse * Mouse | |
Valid when Type == GV_GMOUSE. | |
class GKey * Key | |
Valid when Type == GV_GKEY. | |
} | Value |
The value of the variant. |
char * GVariant::ReleaseStr | ( | ) |
char16 * GVariant::ReleaseWStr | ( | ) |
GVariant & GVariant::Cast | ( | GVariantType | NewType | ) |
Changes the variant's type, maintaining the value where possible. If no conversion is available then nothing happens.
References CastDouble(), CastInt32(), CastInt64(), CastString(), Empty(), GV_BOOL, GV_DATETIME, GV_DOUBLE, GV_INT32, GV_INT64, GV_STRING, GDateTime::Set(), Type, and Value.
int32 GVariant::CastInt32 | ( | ) |
Casts the value to int, from whatever source type. The GVariant type does not change after calling this.
References CastInt32(), GV_BOOL, GV_DOM, GV_DOMREF, GV_DOUBLE, GV_INT32, GV_INT64, GV_STRING, Type, and Value.
Referenced by Cast(), CastInt32(), and GXmlToUi::Convert().
int64 GVariant::CastInt64 | ( | ) |
double GVariant::CastDouble | ( | ) |
char * GVariant::CastString | ( | ) |
Cast to a string from whatever source type, the GVariant will take the type GV_STRING after calling this. This is because returning a static string is not thread safe.
References CastString(), GV_BOOL, GV_DATETIME, GV_DOMREF, GV_DOUBLE, GV_INT32, GV_INT64, GV_STRING, Str(), Type, and Value.
Referenced by Cast(), and CastString().