My Project
|
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 |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
TemplateVariant::TemplateVariant | ( | TemplateStructIntf * | s | ) |
Constructs a new variant with a struct value s.
Definition at line 147 of file template.cpp.
References TemplateStructIntf::addRef(), and m_strukt.
TemplateVariant::TemplateVariant | ( | TemplateListIntf * | l | ) |
Constructs a new variant with a list value l.
Definition at line 153 of file template.cpp.
References TemplateListIntf::addRef(), and m_list.
|
inline |
Constructs a new variant which represents a method call
Definition at line 195 of file template.h.
TemplateVariant::~TemplateVariant | ( | ) |
TemplateVariant::TemplateVariant | ( | const TemplateVariant & | v | ) |
Constructs a copy of the variant, v, passed as the argument to this constructor.
Definition at line 165 of file template.cpp.
References TemplateListIntf::addRef(), TemplateStructIntf::addRef(), Bool, Function, Integer, List, m_boolVal, m_delegate, m_intVal, m_list, m_raw, m_strukt, m_strVal, m_type, None, String, and Struct.
|
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.
References Function, m_delegate, m_type, and TemplateVariant().
Referenced by TemplateNodeVariable::render(), TemplateNodeFor::render(), TemplateNodeCycle::render(), and ExprAstFunctionVariable::resolve().
|
inline |
Returns TRUE if the variant holds a valid value, or FALSE otherwise
Definition at line 161 of file template.h.
Referenced by FilterAdd::apply(), FilterGet::apply(), FilterRaw::apply(), FilterList::apply(), FilterTexLabel::apply(), FilterTexIndex::apply(), FilterLength::apply(), FilterDefault::apply(), FilterFlatten::apply(), FilterRelative::apply(), FilterPaginate::apply(), FilterStripPath::apply(), FilterNoWrap::apply(), FilterDivisibleBy::apply(), FilterIsRelativeURL::apply(), FilterIsAbsoluteURL::apply(), FilterDecodeURL::apply(), FilterFlatten::flatten(), TemplateContextImpl::get(), TemplateNodeTree::renderChildren(), and ExprAstVariable::resolve().
TemplateVariant & TemplateVariant::operator= | ( | const TemplateVariant & | v | ) |
Assigns the value of the variant v to this variant.
Definition at line 181 of file template.cpp.
References TemplateListIntf::addRef(), TemplateStructIntf::addRef(), Bool, Function, Integer, List, m_boolVal, m_delegate, m_intVal, m_list, m_raw, m_strukt, m_strVal, m_type, None, TemplateListIntf::release(), TemplateStructIntf::release(), String, and Struct.
|
inline |
Compares this QVariant with v and returns true if they are equal; otherwise returns false.
Definition at line 211 of file template.h.
References List, m_list, m_strukt, m_type, None, Struct, and toString().
|
inline |
Returns whether or not the value of the Value is raw.
Definition at line 287 of file template.h.
References m_raw.
Referenced by TemplateNodeVariable::render(), and TemplateNodeCycle::render().
|
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.
References m_raw.
Referenced by TemplateNodeTree::renderChildren().
bool TemplateVariant::toBool | ( | ) | const |
Returns the variant as a boolean.
Definition at line 208 of file template.cpp.
References Bool, TemplateListIntf::count(), Function, Integer, List, m_boolVal, m_intVal, m_list, m_strVal, m_type, None, String, and Struct.
Referenced by TemplateNodeIf::render(), ExprAstNegate::resolve(), and ExprAstBinary::resolve().
int TemplateVariant::toInt | ( | ) | const |
Returns the variant as an integer.
Definition at line 223 of file template.cpp.
References Bool, TemplateListIntf::count(), Function, Integer, List, m_boolVal, m_intVal, m_list, m_strVal, m_type, None, String, and Struct.
Referenced by FilterPaginate::apply(), FilterDivisibleBy::apply(), ClassHierarchyContext::Private::preferredDepth(), ClassTreeContext::Private::preferredDepth(), NamespaceTreeContext::Private::preferredDepth(), FileTreeContext::Private::preferredDepth(), PageTreeContext::Private::preferredDepth(), ModuleTreeContext::Private::preferredDepth(), ExampleTreeContext::Private::preferredDepth(), TemplateNodeRepeat::render(), TemplateNodeRange::render(), ExprAstUnary::resolve(), ExprAstBinary::resolve(), and FilterAdd::variantIntValue().
|
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.
References List, m_list, and m_type.
Referenced by FilterLength::apply(), FilterFlatten::apply(), FilterListSort::apply(), FilterGroupBy::apply(), FilterPaginate::apply(), FilterAlphaIndex::apply(), computeMaxDepth(), computeNumNodesAtLevel(), FilterFlatten::flatten(), TemplateContextImpl::get(), TemplateNodeFor::render(), TemplateNodeTree::render(), TemplateNodeMarkers::render(), and TemplateNodeTree::renderChildren().
|
inline |
Returns the variant as a string.
Definition at line 232 of file template.h.
References Bool, Function, Integer, List, m_boolVal, m_intVal, m_strVal, m_type, None, String, and Struct.
Referenced by FilterAdd::apply(), FilterGet::apply(), FilterRaw::apply(), FilterTexLabel::apply(), FilterTexIndex::apply(), FilterAppend::apply(), FilterPrepend::apply(), FilterLength::apply(), FilterDefault::apply(), FilterListSort::apply(), FilterGroupBy::apply(), FilterRelative::apply(), FilterAlphaIndex::apply(), FilterStripPath::apply(), FilterNoWrap::apply(), FilterIsRelativeURL::apply(), FilterIsAbsoluteURL::apply(), FilterDecodeURL::apply(), ExprAstFilter::apply(), FilterListSort::determineSortKey(), FilterGroupBy::determineSortKey(), FilterAlphaIndex::determineSortKey(), NestingNodeContext::id(), operator==(), TemplateNodeVariable::render(), TemplateNodeExtend::render(), TemplateNodeInclude::render(), TemplateNodeCreate::render(), TemplateNodeCycle::render(), TemplateNodeMarkers::render(), TemplateNodeResource::render(), TemplateNodeEncoding::render(), ExprAstBinary::resolve(), and FilterAdd::variantIntValue().
|
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.
References m_strukt, m_type, and Struct.
Referenced by FilterGet::apply(), FilterListSort::apply(), FilterGroupBy::apply(), FilterAlphaIndex::apply(), computeMaxDepth(), computeNumNodesAtLevel(), computePreferredDepth(), FilterFlatten::flatten(), TemplateContextImpl::get(), getPathListFunc(), TemplateNodeFor::render(), and TemplateNodeTree::renderChildren().
|
inline |
Returns the type of the value stored in the variant
Definition at line 142 of file template.h.
References m_type.
Referenced by TemplateContextImpl::addIndexEntry(), FilterAdd::apply(), FilterGet::apply(), FilterRaw::apply(), FilterList::apply(), FilterTexLabel::apply(), FilterTexIndex::apply(), FilterAppend::apply(), FilterPrepend::apply(), FilterLength::apply(), FilterDefault::apply(), FilterFlatten::apply(), FilterListSort::apply(), FilterGroupBy::apply(), FilterRelative::apply(), FilterPaginate::apply(), FilterAlphaIndex::apply(), FilterStripPath::apply(), FilterNoWrap::apply(), FilterDivisibleBy::apply(), FilterIsRelativeURL::apply(), FilterIsAbsoluteURL::apply(), FilterDecodeURL::apply(), ExprAstFilter::apply(), FilterFlatten::flatten(), TemplateContextImpl::get(), getPathListFunc(), TemplateNodeVariable::render(), TemplateNodeRange::render(), TemplateNodeFor::render(), TemplateNodeCycle::render(), TemplateNodeMarkers::render(), ExprAstFunctionVariable::resolve(), ExprAstBinary::resolve(), and FilterAdd::variantIntValue().
|
inline |
Return a string representation of the type of the value stored in the variant
Definition at line 145 of file template.h.
References Bool, Function, Integer, List, m_type, None, String, and Struct.
Referenced by TemplateNodeFor::render(), and TemplateNodeTree::renderChildren().
union { ... } |
bool TemplateVariant::m_boolVal |
Definition at line 295 of file template.h.
Referenced by operator=(), TemplateVariant(), toBool(), toInt(), and toString().
|
private |
Definition at line 299 of file template.h.
Referenced by call(), operator=(), and TemplateVariant().
int TemplateVariant::m_intVal |
Definition at line 294 of file template.h.
Referenced by operator=(), TemplateVariant(), toBool(), toInt(), and toString().
TemplateListIntf* TemplateVariant::m_list |
Definition at line 297 of file template.h.
Referenced by operator=(), operator==(), TemplateVariant(), toBool(), toInt(), toList(), and ~TemplateVariant().
|
private |
Definition at line 300 of file template.h.
Referenced by operator=(), raw(), setRaw(), and TemplateVariant().
TemplateStructIntf* TemplateVariant::m_strukt |
Definition at line 296 of file template.h.
Referenced by operator=(), operator==(), TemplateVariant(), toStruct(), and ~TemplateVariant().
|
private |
Definition at line 291 of file template.h.
Referenced by operator=(), TemplateVariant(), toBool(), toInt(), and toString().
|
private |
Definition at line 290 of file template.h.
Referenced by call(), isValid(), operator=(), operator==(), TemplateVariant(), toBool(), toInt(), toList(), toString(), toStruct(), type(), typeAsString(), and ~TemplateVariant().