21 #include "l10n_money.h"
23 #include "abstractlocalizer.h"
25 #include "exception.h"
30 L10nMoneyNodeFactory::L10nMoneyNodeFactory() {}
39 QStringLiteral(
"Error: l10n_money tag takes at least one argument"));
51 L10nMoneyVarNodeFactory::L10nMoneyVarNodeFactory() {}
62 QStringLiteral(
"Error: l10n_money tag takes at least three arguments"));
71 auto resultName = expr.last();
78 :
Node(parent), m_value(value), m_currency(currency)
84 auto resultString = c->
localizer()->localizeMonetaryValue(
85 m_value.
resolve(c).value<
double>(),
93 const QString &resultName, QObject *parent)
94 :
Node(parent), m_value(value), m_currency(currency),
95 m_resultName(resultName)
102 auto resultString = c->
localizer()->localizeMonetaryValue(
103 m_value.
resolve(c).value<
double>(),
106 c->
insert(m_resultName, resultString);
Q_INVOKABLE QStringList smartSplit(const QString &str) const
The Context class holds the context to render a Template with.
std::shared_ptr< AbstractLocalizer > localizer() const
void insert(const QString &name, QObject *object)
An exception for use when implementing template tags.
A FilterExpression object represents a filter expression in a template.
QVariant resolve(OutputStream *stream, Context *c) const
Base class for all nodes.
void streamValueInContext(OutputStream *stream, const QVariant &input, Cutelee::Context *c) const
The OutputStream class is used to render templates to a QTextStream.
The Parser class processes a string template into a tree of nodes.
const NestedString & get() const
Node * getNode(const QString &tagContent, Parser *p) const override
void render(OutputStream *stream, Context *c) const override
Node * getNode(const QString &tagContent, Parser *p) const override
void render(OutputStream *stream, Context *c) const override
Cutelee::SafeString getSafeString(const QVariant &input)
Utility functions used throughout Cutelee.