KTextTemplate::Variable
#include <KTextTemplate/Variable>
Public Member Functions | |
Variable () | |
Variable (const QString &var) | |
Variable (const Variable &other) | |
~Variable () | |
bool | isConstant () const |
bool | isLocalized () const |
bool | isTrue (Context *c) const |
bool | isValid () const |
QVariant | literal () const |
QStringList | lookups () const |
Variable & | operator= (const Variable &other) |
QVariant | resolve (Context *c) const |
Detailed Description
A container for static variables defined in Templates.
This class is only relevant to Template tag authors.
When processing a template tag in a AbstractNodeFactory implementation, it will sometimes make sense to process arguments to the tag as KTextTemplate::Variables. Note that usually they should be processed as FilterExpression objects instead.
Arguments to the tag can be used to construct Variables, which may then be resolved into the objects they represent in the given Context in the render stage.
Definition at line 41 of file variable.h.
Constructor & Destructor Documentation
◆ Variable() [1/3]
Variable::Variable | ( | ) |
Constructs an invalid Variable
Definition at line 51 of file variable.cpp.
◆ Variable() [2/3]
|
explicit |
Creates a Variable represented by the given var
.
Definition at line 72 of file variable.cpp.
◆ Variable() [3/3]
Variable::Variable | ( | const Variable & | other | ) |
Copy constructor.
Definition at line 45 of file variable.cpp.
◆ ~Variable()
Variable::~Variable | ( | ) |
Destructor.
Definition at line 56 of file variable.cpp.
Member Function Documentation
◆ isConstant()
bool Variable::isConstant | ( | ) | const |
Returns whether this Variable is a constant in the Template.
A constant is represented as a static string in the template
Definition at line 125 of file variable.cpp.
◆ isLocalized()
bool Variable::isLocalized | ( | ) | const |
Returns whether this variable is localized, that is, if it is wrapped with _().
Definition at line 136 of file variable.cpp.
◆ isTrue()
bool Variable::isTrue | ( | Context * | c | ) | const |
Returns whether this Variable evaluates to true with the Context c
.
Definition at line 131 of file variable.cpp.
◆ isValid()
bool Variable::isValid | ( | ) | const |
Returns whether this Variable is valid.
Definition at line 119 of file variable.cpp.
◆ literal()
QVariant Variable::literal | ( | ) | const |
Returns whether this variable is a literal string or number.
A literal Variable does not have any lookup components.
Definition at line 142 of file variable.cpp.
◆ lookups()
QStringList Variable::lookups | ( | ) | const |
Returns the lookup components of this Variable.
Definition at line 148 of file variable.cpp.
◆ operator=()
Assignment operator.
Definition at line 61 of file variable.cpp.
◆ resolve()
Resolves this Variable with the Context c
.
Definition at line 163 of file variable.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:17:29 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.