23 #include "metaenumvariable_p.h" 24 #include "nodebuiltins_p.h" 28 #include <QtCore/QRegularExpressionMatchIterator> 38 Q_DECLARE_PUBLIC(
Node)
46 #if defined(Q_CC_MSVC) 49 #define STRING_LITERAL QLatin1String 51 #define STRING_LITERAL QStringLiteral 59 "(?:[^\"\\\\]|\\\\.)*\"" 62 "(?:[^\'\\\\]|\\\\.)*\'" 92 if (input.
userType() == qMetaTypeId<QVariantList>()) {
93 inputString = toString(input.
value<QVariantList>());
94 }
else if (input.
userType() == qMetaTypeId<MetaEnumVariable>()) {
95 const auto mev = input.
value<MetaEnumVariable>();
101 if (c->autoEscape() && !inputString.
isSafe())
102 inputString.setNeedsEscape(
true);
104 (*stream) << inputString;
111 while (_parent && !ti) {
112 _parent = _parent->parent();
123 m_containsNonText = list.m_containsNonText;
130 m_containsNonText = list.m_containsNonText;
138 auto textNode = qobject_cast<TextNode *>(node);
140 m_containsNonText =
true;
144 m_containsNonText =
false;
151 if (!m_containsNonText) {
152 auto textNode = qobject_cast<TextNode *>(node);
154 m_containsNonText =
true;
162 if (!m_containsNonText) {
164 auto textNode = qobject_cast<
const TextNode *>(node);
166 m_containsNonText =
true;
179 for (
auto i = 0; i < this->
size(); ++i) {
180 this->
at(i)->render(stream, c);
196 for (
auto &varString : list) {
207 auto i = d->smartSplitRe.globalMatch(str);
208 while (i.hasNext()) {
209 auto match = i.next();
210 l.
append(match.captured());
TemplateImpl * containerTemplate() const
bool containsNonText() const
The Context class holds the context to render a Template with.
QList< FilterExpression > getFilterExpressionList(const QStringList &list, Parser *p) const
The Cutelee namespace holds all public Cutelee API.
void append(Cutelee::Node *node)
AbstractNodeFactory(QObject *parent={})
const T & at(int i) const const
~AbstractNodeFactory() override
Base class for all NodeFactories.
QString number(int n, int base)
void append(const T &value)
Base class for all nodes.
Utility functions used throughout Cutelee.
A QString wrapper class for containing whether a string is safe or needs to be escaped.
int userType() const const
The OutputStream class is used to render templates to a QTextStream.
The Parser class processes a string template into a tree of nodes.
A list of Nodes with some convenience API for rendering them.
A FilterExpression object represents a filter expression in a template.
Q_INVOKABLE QStringList smartSplit(const QString &str) const
void streamValueInContext(OutputStream *stream, const QVariant &input, Cutelee::Context *c) const
T qobject_cast(QObject *object)
QObject * parent() const const
Cutelee::SafeString getSafeString(const QVariant &input)
void render(OutputStream *stream, Context *c) const