Variant type which can hold one value of a fixed set of types. More...
#include <template.h>
Classes | |
class | Delegate |
Helper class to create a delegate that can store a function/method call. More... | |
Public Types | |
enum | Type { None, Bool, Integer, String, Struct, List, Function } |
Public Member Functions | |
Type | type () const |
QCString | typeAsString () const |
bool | isValid () const |
TemplateVariant () | |
TemplateVariant (bool b) | |
TemplateVariant (int v) | |
TemplateVariant (const char *s, bool raw=FALSE) | |
TemplateVariant (const QCString &s, bool raw=FALSE) | |
TemplateVariant (TemplateStructIntf *s) | |
TemplateVariant (TemplateListIntf *l) | |
TemplateVariant (const Delegate &delegate) | |
~TemplateVariant () | |
TemplateVariant (const TemplateVariant &v) | |
TemplateVariant & | operator= (const TemplateVariant &v) |
bool | operator== (TemplateVariant &other) |
QCString | toString () const |
bool | toBool () const |
int | toInt () const |
TemplateListIntf * | toList () const |
TemplateStructIntf * | toStruct () const |
TemplateVariant | call (const QValueList< TemplateVariant > &args) |
void | setRaw (bool b) |
bool | raw () const |
Private Attributes | |
Type | m_type |
QCString | m_strVal |
union { | |
int m_intVal | |
bool m_boolVal | |
TemplateStructIntf * m_strukt | |
TemplateListIntf * m_list | |
}; | |
Delegate | m_delegate |
bool | m_raw |
Variant type which can hold one value of a fixed set of types.
Definition at line 90 of file template.h.
Types of data that can be stored in a TemplateVariant
Enumerator | |
---|---|
None | |
Bool | |
Integer | |
String | |
Struct | |
List | |
Function |
Definition at line 139 of file template.h.
|
inline |
Constructs an invalid variant.
Definition at line 164 of file template.h.
|
inlineexplicit |
Constructs a new variant with a boolean value b.
Definition at line 167 of file template.h.
|
inline |
Constructs a new variant with a integer value v.
Definition at line 170 of file template.h.
Constructs a new variant with a string value s.
Definition at line 173 of file template.h.
Constructs a new variant with a string value s.
Definition at line 176 of file template.h.
TemplateVariant::TemplateVariant | ( | TemplateStructIntf * | s | ) |
Constructs a new variant with a struct value s.
Definition at line 146 of file template.cpp.
TemplateVariant::TemplateVariant | ( | TemplateListIntf * | l | ) |
Constructs a new variant with a list value l.
Definition at line 152 of file template.cpp.
|
inline |
Constructs a new variant which represents a method call
Definition at line 195 of file template.h.
TemplateVariant::~TemplateVariant | ( | ) |
Destroys the Variant object
Definition at line 158 of file template.cpp.
TemplateVariant::TemplateVariant | ( | const TemplateVariant & | v | ) |
Constructs a copy of the variant, v, passed as the argument to this constructor.
Definition at line 164 of file template.cpp.
|
inline |
Return the result of apply this function with args. Returns an empty string if the variant type is not a function.
Definition at line 272 of file template.h.
|
inline |
Returns TRUE if the variant holds a valid value, or FALSE otherwise
Definition at line 161 of file template.h.
TemplateVariant & TemplateVariant::operator= | ( | const TemplateVariant & | v | ) |
Assigns the value of the variant v to this variant.
Definition at line 180 of file template.cpp.
|
inline |
Compares this QVariant with v and returns true if they are equal; otherwise returns false.
Definition at line 211 of file template.h.
|
inline |
Returns whether or not the value of the Value is raw.
Definition at line 287 of file template.h.
|
inline |
Sets whether or not the value of the Variant should be escaped or written as-is (raw).
[in] | b | TRUE means write as-is, FALSE means apply escaping. |
Definition at line 282 of file template.h.
bool TemplateVariant::toBool | ( | ) | const |
Returns the variant as a boolean.
Definition at line 207 of file template.cpp.
int TemplateVariant::toInt | ( | ) | const |
Returns the variant as an integer.
Definition at line 222 of file template.cpp.
|
inline |
Returns the pointer to list referenced by this variant or 0 if this variant does not have list type.
Definition at line 256 of file template.h.
|
inline |
Returns the variant as a string.
Definition at line 232 of file template.h.
|
inline |
Returns the pointer to struct referenced by this variant or 0 if this variant does not have struct type.
Definition at line 264 of file template.h.
|
inline |
|
inline |
Return a string representation of the type of the value stored in the variant
Definition at line 145 of file template.h.
union { ... } |
bool TemplateVariant::m_boolVal |
Definition at line 295 of file template.h.
|
private |
Definition at line 299 of file template.h.
int TemplateVariant::m_intVal |
Definition at line 294 of file template.h.
TemplateListIntf* TemplateVariant::m_list |
Definition at line 297 of file template.h.
|
private |
Definition at line 300 of file template.h.
TemplateStructIntf* TemplateVariant::m_strukt |
Definition at line 296 of file template.h.
|
private |
Definition at line 291 of file template.h.
|
private |
Definition at line 290 of file template.h.