23#include "metaenumvariable_p.h"
24#include "nodebuiltins_p.h"
28#include <QtCore/QRegularExpressionMatchIterator>
37 NodePrivate(
Node *node) : q_ptr(node) {}
38 Q_DECLARE_PUBLIC(
Node)
42class AbstractNodeFactoryPrivate
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());
Base class for all NodeFactories.
~AbstractNodeFactory() override
AbstractNodeFactory(QObject *parent={})
QList< FilterExpression > getFilterExpressionList(const QStringList &list, Parser *p) const
Q_INVOKABLE QStringList smartSplit(const QString &str) const
The Context class holds the context to render a Template with.
A FilterExpression object represents a filter expression in a template.
A list of Nodes with some convenience API for rendering them.
bool containsNonText() const
void render(OutputStream *stream, Context *c) const
void append(Cutelee::Node *node)
Base class for all nodes.
void streamValueInContext(OutputStream *stream, const QVariant &input, Cutelee::Context *c) const
TemplateImpl * containerTemplate() 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 QString wrapper class for containing whether a string is safe or needs to be escaped.
The Cutelee namespace holds all public Cutelee API.
Cutelee::SafeString getSafeString(const QVariant &input)
void append(const T &value)
const T & at(int i) const const
QObject * parent() const const
T qobject_cast(QObject *object)
QString number(int n, int base)
int userType() const const
Utility functions used throughout Cutelee.