ISLEman
Classes | Public Types | Public Member Functions | List of all members
TemplateVariant Class Reference

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
}
 Types of data that can be stored in a TemplateVariant.
 

Public Member Functions

Type type () const
 Returns the type of the value stored in the variant.
 
QCString typeAsString () const
 Return a string representation of the type of the value stored in the variant.
 
bool isValid () const
 Returns TRUE if the variant holds a valid value, or FALSE otherwise.
 
 TemplateVariant ()
 Constructs an invalid variant. More...
 
 TemplateVariant (bool b)
 Constructs a new variant with a boolean value b. More...
 
 TemplateVariant (int v)
 Constructs a new variant with a integer value v. More...
 
 TemplateVariant (const char *s, bool raw=FALSE)
 Constructs a new variant with a string value s. More...
 
 TemplateVariant (const QCString &s, bool raw=FALSE)
 Constructs a new variant with a string value s. More...
 
 TemplateVariant (TemplateStructIntf *s)
 Constructs a new variant with a struct value s. More...
 
 TemplateVariant (TemplateListIntf *l)
 Constructs a new variant with a list value l. More...
 
 TemplateVariant (const Delegate &delegate)
 Constructs a new variant which represents a method call. More...
 
 ~TemplateVariant ()
 Destroys the Variant object.
 
 TemplateVariant (const TemplateVariant &v)
 Constructs a copy of the variant, v, passed as the argument to this constructor.
 
TemplateVariantoperator= (const TemplateVariant &v)
 Assigns the value of the variant v to this variant. More...
 
bool operator== (TemplateVariant &other)
 Compares this QVariant with v and returns true if they are equal; otherwise returns false.
 
QCString toString () const
 Returns the variant as a string. More...
 
bool toBool () const
 Returns the variant as a boolean. More...
 
int toInt () const
 Returns the variant as an integer. More...
 
TemplateListIntftoList () const
 Returns the pointer to list referenced by this variant or 0 if this variant does not have list type.
 
TemplateStructIntftoStruct () const
 Returns the pointer to struct referenced by this variant or 0 if this variant does not have struct type.
 
TemplateVariant call (const QValueList< TemplateVariant > &args)
 Return the result of apply this function with args. More...
 
void setRaw (bool b)
 Sets whether or not the value of the Variant should be escaped or written as-is (raw). More...
 
bool raw () const
 Returns whether or not the value of the Value is raw. More...
 

Detailed Description

Variant type which can hold one value of a fixed set of types.

Constructor & Destructor Documentation

§ TemplateVariant() [1/8]

TemplateVariant::TemplateVariant ( )
inline

Constructs an invalid variant.

§ TemplateVariant() [2/8]

TemplateVariant::TemplateVariant ( bool  b)
inlineexplicit

Constructs a new variant with a boolean value b.

§ TemplateVariant() [3/8]

TemplateVariant::TemplateVariant ( int  v)
inline

Constructs a new variant with a integer value v.

§ TemplateVariant() [4/8]

TemplateVariant::TemplateVariant ( const char *  s,
bool  raw = FALSE 
)
inline

Constructs a new variant with a string value s.

§ TemplateVariant() [5/8]

TemplateVariant::TemplateVariant ( const QCString s,
bool  raw = FALSE 
)
inline

Constructs a new variant with a string value s.

§ TemplateVariant() [6/8]

TemplateVariant::TemplateVariant ( TemplateStructIntf s)

Constructs a new variant with a struct value s.

Note
. The variant will hold a reference to the object.

§ TemplateVariant() [7/8]

TemplateVariant::TemplateVariant ( TemplateListIntf l)

Constructs a new variant with a list value l.

Note
. The variant will hold a reference to the object.

§ TemplateVariant() [8/8]

TemplateVariant::TemplateVariant ( const Delegate delegate)
inline

Constructs a new variant which represents a method call.

Parameters
[in]delegateDelegate object to invoke when calling call() on this variant.
Note
Use TemplateVariant::Delegate::fromMethod() and TemplateVariant::Delegate::fromFunction() to create Delegate objects.

Member Function Documentation

§ call()

TemplateVariant TemplateVariant::call ( const QValueList< TemplateVariant > &  args)
inline

Return the result of apply this function with args.

Returns an empty string if the variant type is not a function.

§ operator=()

TemplateVariant & TemplateVariant::operator= ( const TemplateVariant v)

Assigns the value of the variant v to this variant.

§ raw()

bool TemplateVariant::raw ( ) const
inline

Returns whether or not the value of the Value is raw.

See also
setRaw()

§ setRaw()

void TemplateVariant::setRaw ( bool  b)
inline

Sets whether or not the value of the Variant should be escaped or written as-is (raw).

Parameters
[in]bTRUE means write as-is, FALSE means apply escaping.

§ toBool()

bool TemplateVariant::toBool ( ) const

Returns the variant as a boolean.

§ toInt()

int TemplateVariant::toInt ( ) const

Returns the variant as an integer.

§ toString()

QCString TemplateVariant::toString ( ) const
inline

Returns the variant as a string.


The documentation for this class was generated from the following files: