Doxygen
|
Variant type which can hold one value of a fixed set of types. 更多...
#include <template.h>
Public 类型 | |
enum | Type : uint8_t { Type::Bool = 0, Type::Int = 1, Type::String = 2, Type::Struct = 3, Type::List = 4, Type::Function = 5, Type::WeakStruct = 6, Type::None = 255 } |
using | FunctionDelegate = std::function< TemplateVariant(const std::vector< TemplateVariant > &)> |
Type representing a function call in a template 更多... | |
using | VariantT = Variant< bool, int, QCString, TemplateStructIntfPtr, TemplateListIntfPtr, FunctionDelegate, TemplateStructIntfWeakPtr > |
Symbolic names for the possible types that this variant can hold. 更多... | |
Public 成员函数 | |
TemplateVariant () | |
Constructs an invalid variant. 更多... | |
TemplateVariant (bool b) | |
Constructs a new variant with a boolean value b. 更多... | |
TemplateVariant (int v) | |
Constructs a new variant with a integer value v. 更多... | |
TemplateVariant (const char *s, bool raw=FALSE) | |
Constructs a new variant with a string value s. 更多... | |
TemplateVariant (const QCString &s, bool raw=FALSE) | |
Constructs a new variant with a string value s. 更多... | |
TemplateVariant (const std::string &s, bool raw=FALSE) | |
Constructs a new variant with a string value s. 更多... | |
TemplateVariant (TemplateStructIntfPtr s) | |
Constructs a new variant with a struct value s. 更多... | |
TemplateVariant (TemplateListIntfPtr l) | |
Constructs a new variant with a list value l. 更多... | |
TemplateVariant (TemplateStructIntfWeakPtr s) | |
Constructs a new variant with a struct value s. 更多... | |
TemplateVariant (FunctionDelegate delegate) | |
Constructs a new variant which represents a method call 更多... | |
~TemplateVariant ()=default | |
Destroys the Variant object 更多... | |
TemplateVariant (const TemplateVariant &v)=default | |
Constructs a copy of the variant, v, passed as the argument to this constructor. 更多... | |
TemplateVariant (TemplateVariant &&v) | |
Moves the contents of variant v into this variant. 更多... | |
TemplateVariant & | operator= (const TemplateVariant &v)=default |
Assigns the value of the variant v to this variant. 更多... | |
TemplateVariant & | operator= (TemplateVariant &&v) |
Move the value of the variant v into this variant. 更多... | |
bool | operator== (TemplateVariant &other) const |
Compares this QVariant with v and returns true if they are equal; otherwise returns false. 更多... | |
QCString | toString () const |
Returns the variant as a string. 更多... | |
bool | toBool () const |
Returns the variant as a boolean. 更多... | |
int | toInt () const |
Returns the variant as an integer. 更多... | |
constexpr bool | isValid () const |
Returns TRUE if the variant holds a valid value, or FALSE otherwise 更多... | |
constexpr bool | isBool () const |
Returns TRUE if the variant holds a boolean value 更多... | |
constexpr bool | isInt () const |
Returns TRUE if the variant holds an integer value 更多... | |
constexpr bool | isString () const |
Returns TRUE if the variant holds a string value 更多... | |
constexpr bool | isStruct () const |
Returns TRUE if the variant holds a struct value 更多... | |
constexpr bool | isList () const |
Returns TRUE if the variant holds a list value 更多... | |
constexpr bool | isFunction () const |
Returns TRUE if the variant holds a function value 更多... | |
constexpr bool | isWeakStruct () const |
Returns TRUE if the variant holds a struct value 更多... | |
TemplateListIntfPtr | toList () |
Returns the pointer to list referenced by this variant or 0 if this variant does not have list type. 更多... | |
const TemplateListIntfPtr | toList () const |
TemplateStructIntfPtr | toStruct () |
Returns the pointer to struct referenced by this variant or 0 if this variant does not have struct type. 更多... | |
const TemplateStructIntfPtr | toStruct () const |
TemplateVariant | call (const std::vector< TemplateVariant > &args=std::vector< TemplateVariant >()) |
Return the result of apply this function with args. 更多... | |
void | setRaw (bool b) |
Sets whether or not the value of the Variant should be escaped or written as-is (raw). 更多... | |
constexpr bool | raw () const |
Returns whether or not the value of the Value is raw. 更多... | |
constexpr Type | type () const |
Returns the type held by this variant 更多... | |
const char * | typeAsString () const |
Returns a string representation of this variant's type 更多... | |
Private 成员函数 | |
QCString | listToString () const |
QCString | structToString () const |
Private 属性 | |
VariantT | m_variant |
bool | m_raw = false |
Variant type which can hold one value of a fixed set of types.
在文件 template.h 第 98 行定义.
using TemplateVariant::FunctionDelegate = std::function<TemplateVariant(const std::vector<TemplateVariant>&)> |
Type representing a function call in a template
在文件 template.h 第 102 行定义.
using TemplateVariant::VariantT = Variant<bool, int, QCString, TemplateStructIntfPtr, TemplateListIntfPtr, FunctionDelegate, TemplateStructIntfWeakPtr > |
Symbolic names for the possible types that this variant can hold.
在文件 template.h 第 112 行定义.
|
strong |
枚举值 | |
---|---|
Bool | |
Int | |
String | |
Struct | |
List | |
Function | |
WeakStruct | |
None |
在文件 template.h 第 114 行定义.
|
inline |
|
inlineexplicit |
Constructs a new variant with a boolean value b.
在文件 template.h 第 130 行定义.
引用了 Bool, m_variant , 以及 Variant< Ts >::set().
|
inline |
Constructs a new variant with a integer value v.
在文件 template.h 第 133 行定义.
引用了 Int, m_variant , 以及 Variant< Ts >::set().
|
inline |
Constructs a new variant with a string value s.
在文件 template.h 第 136 行定义.
引用了 m_variant, Variant< Ts >::set() , 以及 String.
Constructs a new variant with a string value s.
在文件 template.h 第 139 行定义.
引用了 m_variant, Variant< Ts >::set(), QCString::str() , 以及 String.
|
inline |
Constructs a new variant with a string value s.
在文件 template.h 第 142 行定义.
引用了 m_variant, Variant< Ts >::set() , 以及 String.
|
inline |
Constructs a new variant with a struct value s.
在文件 template.h 第 147 行定义.
引用了 m_variant, Variant< Ts >::set() , 以及 Struct.
|
inline |
Constructs a new variant with a list value l.
在文件 template.h 第 152 行定义.
引用了 List, m_variant , 以及 Variant< Ts >::set().
|
inline |
Constructs a new variant with a struct value s.
在文件 template.h 第 157 行定义.
引用了 m_variant, Variant< Ts >::set() , 以及 WeakStruct.
|
inline |
Constructs a new variant which represents a method call
[in] | delegate | FunctionDelegate object to invoke when calling call() on this variant. |
在文件 template.h 第 166 行定义.
引用了 Function, m_variant , 以及 Variant< Ts >::set().
|
default |
Destroys the Variant object
|
default |
Constructs a copy of the variant, v, passed as the argument to this constructor.
TemplateVariant::TemplateVariant | ( | TemplateVariant && | v | ) |
Moves the contents of variant v into this variant.
variant v will become invalid
在文件 template.cpp 第 327 行定义.
TemplateVariant TemplateVariant::call | ( | const std::vector< TemplateVariant > & | args = std::vector<TemplateVariant>() | ) |
Return the result of apply this function with args.
Returns an empty string if the variant type is not a function.
在文件 template.cpp 第 454 行定义.
引用了 Function, Variant< Ts >::get(), isFunction(), m_variant , 以及 TemplateVariant().
被这些函数引用 TemplateNodeVariable::render(), TemplateNodeFor::render(), TemplateNodeCycle::render() , 以及 ExprAstFunctionVariable::resolve().
|
inlineconstexpr |
Returns TRUE if the variant holds a boolean value
在文件 template.h 第 205 行定义.
引用了 Bool, Variant< Ts >::is() , 以及 m_variant.
被这些函数引用 operator==().
|
inlineconstexpr |
Returns TRUE if the variant holds a function value
在文件 template.h 第 215 行定义.
引用了 Function, Variant< Ts >::is() , 以及 m_variant.
被这些函数引用 call(), TemplateNodeVariable::render(), TemplateNodeFor::render(), TemplateNodeCycle::render() , 以及 ExprAstFunctionVariable::resolve().
|
inlineconstexpr |
Returns TRUE if the variant holds an integer value
在文件 template.h 第 207 行定义.
引用了 Int, Variant< Ts >::is() , 以及 m_variant.
被这些函数引用 FilterRaw::apply(), FilterAppend::apply(), FilterPrepend::apply(), FilterPaginate::apply(), FilterDivisibleBy::apply(), operator==(), TemplateNodeRange::render() , 以及 FilterAdd::variantIntValue().
|
inlineconstexpr |
Returns TRUE if the variant holds a list value
在文件 template.h 第 213 行定义.
引用了 Variant< Ts >::is(), List , 以及 m_variant.
被这些函数引用 FilterKeep::apply(), FilterList::apply(), FilterLength::apply(), FilterFlatten::apply(), FilterListSort::apply(), FilterGroupBy::apply(), FilterPaginate::apply(), FilterAlphaIndex::apply(), FilterFlatten::flatten(), TemplateContextImpl::get(), operator==() , 以及 toList().
|
inlineconstexpr |
Returns TRUE if the variant holds a string value
在文件 template.h 第 209 行定义.
引用了 Variant< Ts >::is(), m_variant , 以及 String.
被这些函数引用 FilterAdd::apply(), FilterGet::apply(), FilterRaw::apply(), FilterKeep::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(), FilterLower::apply(), FilterUpper::apply(), FilterEscape::apply(), FilterDecodeURL::apply(), TemplateNodeMarkers::render(), ExprAstBinary::resolve() , 以及 FilterAdd::variantIntValue().
|
inlineconstexpr |
Returns TRUE if the variant holds a struct value
在文件 template.h 第 211 行定义.
引用了 Variant< Ts >::is(), m_variant , 以及 Struct.
被这些函数引用 FilterGet::apply(), TemplateContextImpl::get(), getPathListFunc(), operator==(), TemplateNodeFor::render() , 以及 toStruct().
|
inlineconstexpr |
Returns TRUE if the variant holds a valid value, or FALSE otherwise
在文件 template.h 第 203 行定义.
引用了 m_variant , 以及 Variant< Ts >::valid().
被这些函数引用 FilterAdd::apply(), FilterGet::apply(), FilterRaw::apply(), FilterKeep::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(), FilterLower::apply(), FilterUpper::apply(), FilterHex::apply(), FilterEscape::apply(), FilterDecodeURL::apply(), FilterFlatten::flatten(), TemplateContextImpl::get(), TemplateNodeTree::renderChildren() , 以及 ExprAstVariable::resolve().
|
inlineconstexpr |
Returns TRUE if the variant holds a struct value
在文件 template.h 第 217 行定义.
引用了 Variant< Ts >::is(), m_variant , 以及 WeakStruct.
被这些函数引用 FilterGet::apply(), TemplateContextImpl::get(), getPathListFunc(), operator==(), TemplateNodeFor::render(), structToString() , 以及 toStruct().
|
private |
|
default |
Assigns the value of the variant v to this variant.
TemplateVariant & TemplateVariant::operator= | ( | TemplateVariant && | v | ) |
bool TemplateVariant::operator== | ( | TemplateVariant & | other | ) | const |
Compares this QVariant with v and returns true if they are equal; otherwise returns false.
在文件 template.cpp 第 342 行定义.
引用了 Bool, FALSE, Variant< Ts >::get(), Int, isBool(), isInt(), isList(), isStruct(), isWeakStruct(), m_variant, toList(), toString(), toStruct() , 以及 Variant< Ts >::valid().
|
inlineconstexpr |
Returns whether or not the value of the Value is raw.
在文件 template.h 第 245 行定义.
引用了 m_raw.
被这些函数引用 TemplateNodeVariable::render() , 以及 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. |
在文件 template.h 第 240 行定义.
引用了 m_raw.
被这些函数引用 TemplateNodeTree::renderChildren().
|
private |
bool TemplateVariant::toBool | ( | ) | const |
Returns the variant as a boolean.
在文件 template.cpp 第 367 行定义.
引用了 Bool, FALSE, Function, Variant< Ts >::get(), Int, List, m_variant, None, String, Struct, type() , 以及 WeakStruct.
被这些函数引用 FilterKeep::apply(), TemplateNodeIf::render() , 以及 ExprAstBinary::resolve().
int TemplateVariant::toInt | ( | ) | const |
Returns the variant as an integer.
在文件 template.cpp 第 383 行定义.
引用了 Bool, Function, Variant< Ts >::get(), Int, List, m_variant, None, String, Struct, type() , 以及 WeakStruct.
被这些函数引用 FilterPaginate::apply(), FilterDivisibleBy::apply(), FilterHex::apply(), TemplateNodeRepeat::render(), TemplateNodeRange::render(), ExprAstUnary::resolve(), ExprAstBinary::resolve() , 以及 FilterAdd::variantIntValue().
const TemplateListIntfPtr TemplateVariant::toList | ( | ) |
Returns the pointer to list referenced by this variant or 0 if this variant does not have list type.
在文件 template.cpp 第 432 行定义.
引用了 Variant< Ts >::get(), isList(), List , 以及 m_variant.
被这些函数引用 FilterKeep::apply(), FilterLength::apply(), FilterFlatten::apply(), FilterListSort::apply(), FilterGroupBy::apply(), FilterPaginate::apply(), FilterAlphaIndex::apply(), computeMaxDepth(), computeNumNodesAtLevel(), FilterFlatten::flatten(), TemplateContextImpl::get(), listToString(), operator==(), TemplateNodeFor::render(), TemplateNodeTree::render(), TemplateNodeMarkers::render() , 以及 TemplateNodeTree::renderChildren().
const TemplateListIntfPtr TemplateVariant::toList | ( | ) | const |
QCString TemplateVariant::toString | ( | ) | const |
Returns the variant as a string.
在文件 template.cpp 第 399 行定义.
引用了 Bool, Function, Variant< Ts >::get(), Int, List, listToString(), m_variant, None, QCString::setNum(), String, Struct, structToString(), type() , 以及 WeakStruct.
被这些函数引用 FilterAdd::apply(), FilterGet::apply(), FilterRaw::apply(), FilterKeep::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(), FilterLower::apply(), FilterUpper::apply(), FilterEscape::apply(), FilterDecodeURL::apply(), ExprAstFilter::apply(), FilterListSort::determineSortKey(), FilterGroupBy::determineSortKey(), FilterAlphaIndex::determineSortKey(), listToString(), operator==(), TemplateNodeVariable::render(), TemplateNodeCycle::render(), TemplateNodeMarkers::render(), ExprAstBinary::resolve() , 以及 FilterAdd::variantIntValue().
const TemplateStructIntfPtr TemplateVariant::toStruct | ( | ) |
Returns the pointer to struct referenced by this variant or 0 if this variant does not have struct type.
在文件 template.cpp 第 441 行定义.
引用了 Variant< Ts >::get(), isStruct(), isWeakStruct(), m_variant, Struct , 以及 WeakStruct.
被这些函数引用 FilterGet::apply(), FilterKeep::apply(), FilterListSort::apply(), FilterGroupBy::apply(), FilterAlphaIndex::apply(), computeMaxDepth(), computeNumNodesAtLevel(), computePreferredDepth(), FilterFlatten::flatten(), TemplateContextImpl::get(), getPathListFunc(), operator==(), TemplateNodeFor::render(), TemplateNodeTree::renderChildren() , 以及 structToString().
const TemplateStructIntfPtr TemplateVariant::toStruct | ( | ) | const |
|
inlineconstexpr |
Returns the type held by this variant
在文件 template.h 第 248 行定义.
引用了 Variant< Ts >::index() , 以及 m_variant.
被这些函数引用 ExprAstFilter::apply(), toBool(), toInt(), toString() , 以及 typeAsString().
const char * TemplateVariant::typeAsString | ( | ) | const |
Returns a string representation of this variant's type
Return a string representation of the type of the value stored in the variant
在文件 template.cpp 第 416 行定义.
引用了 Bool, Function, Int, List, None, String, Struct, type() , 以及 WeakStruct.
被这些函数引用 TemplateNodeFor::render() , 以及 TemplateNodeTree::renderChildren().
|
private |
在文件 template.h 第 258 行定义.
被这些函数引用 operator=(), raw(), setRaw() , 以及 TemplateVariant().
|
private |
在文件 template.h 第 257 行定义.
被这些函数引用 call(), isBool(), isFunction(), isInt(), isList(), isString(), isStruct(), isValid(), isWeakStruct(), operator=(), operator==(), TemplateVariant(), toBool(), toInt(), toList(), toString(), toStruct() , 以及 type().