KTextTemplate
filterexpression.cpp
50 const QLatin1String varChars("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.");
58 const QString localizedExpression = QStringLiteral("(?:") + i18nOpen + doubleQuoteStringLiteral + i18nClose + QLatin1Char('|') + i18nOpen
59 + singleQuoteStringLiteral + i18nClose + QLatin1Char('|') + i18nOpen + numChars + i18nClose + QLatin1Char('|') + i18nOpen + variable + i18nClose
62 const QString constantString = QStringLiteral("(?:") + doubleQuoteStringLiteral + QLatin1Char('|') + singleQuoteStringLiteral + QLatin1Char(')');
64 const QString filterRawString = QLatin1Char('^') + constantString + QLatin1Char('|') + QLatin1Char('^') + localizedExpression + QLatin1Char('|')
65 + QLatin1Char('^') + variable + QLatin1Char('|') + numChars + QLatin1Char('|') + filterSep + QStringLiteral("\\w+|") + argSep + QStringLiteral("(?:")
66 + constantString + QLatin1Char('|') + localizedExpression + QLatin1Char('|') + variable + QLatin1Char('|') + numChars + QLatin1Char('|') + filterSep
96 throw KTextTemplate::Exception(TagSyntaxError, QStringLiteral("Could not parse some characters: \"%1\"").arg(varString.mid(lastPos, pos)));
111 throw KTextTemplate::Exception(TagSyntaxError, QStringLiteral("Could not parse the remainder, %1 from %2").arg(remainder, varString));
116 throw KTextTemplate::Exception(EmptyVariableError, QStringLiteral("Missing argument to filter: %1").arg(d->m_filterNames[lastFilter - 1]));
130 throw KTextTemplate::Exception(TagSyntaxError, QStringLiteral("Could not parse the remainder, %1 from %2").arg(remainder, varString));
The Context class holds the context to render a Template with.
Definition context.h:107
An exception for use when implementing template tags.
Definition exception.h:74
A FilterExpression object represents a filter expression in a template.
Definition filterexpression.h:109
QVariantList toList(Context *c) const
Returns a list for the FilterExpression.
Definition filterexpression.cpp:228
bool isTrue(Context *c) const
Returns whether the Filter resolves to true in the Context c.
Definition filterexpression.cpp:236
QVariant resolve(OutputStream *stream, Context *c) const
Resolves the FilterExpression in the Context c and writes it to the stream stream.
Definition filterexpression.cpp:176
Variable variable() const
Returns the initial variable in the FilterExpression.
Definition filterexpression.cpp:160
FilterExpression & operator=(const FilterExpression &other)
Assignment operator.
Definition filterexpression.cpp:166
bool isValid() const
Returns whether a filter expression is valid.
Definition filterexpression.cpp:149
The OutputStream class is used to render templates to a QTextStream.
Definition outputstream.h:70
The Parser class processes a string template into a tree of nodes.
Definition parser.h:38
QSharedPointer< Filter > getFilter(const QString &name) const
Returns the filter object called name or an invalid object if no filter with that name is loaded.
Definition parser.cpp:138
A QString wrapper class for containing whether a string is safe or needs to be escaped.
Definition safestring.h:81
const NestedString & get() const
Returns the String held by this SafeString
Definition safestring.h:283
A container for static variables defined in Templates.
Definition variable.h:42
The KTextTemplate namespace holds all public KTextTemplate API.
Definition Mainpage.dox:8
KTextTemplate::SafeString markForEscaping(const KTextTemplate::SafeString &input)
Marks the input as requiring escaping.
Definition util.cpp:81
KTextTemplate::SafeString getSafeString(const QVariant &input)
Retrieves and returns a SafeString from the input.
Definition util.cpp:91
bool variantIsTrue(const QVariant &variant)
Returns whether the variant is evaluated to true.
Definition util.cpp:24
KTextTemplate::SafeString markSafe(const KTextTemplate::SafeString &input)
Marks the input as safe.
Definition util.cpp:74
QChar fromLatin1(char c)
QString escape(QStringView str)
bool isEmpty() const const
QString mid(qsizetype position, qsizetype n) const const
QString right(qsizetype n) const const
qsizetype size() const const
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
Q_D(Todo)
Utility functions used throughout KTextTemplate.
This file is part of the KDE documentation.
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
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.