Cutelee 6.1.0
l10n_filesize.h
1/*
2 * This file is part of the Cutelee template system.
3 *
4 * Copyright (c) 2020 Matthias Fehring <mf@huessenbergnetz.de>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef L10N_FILESIZE_H
21#define L10N_FILESIZE_H
22
23#include "node.h"
24
25namespace Cutelee
26{
27 class Parser;
28}
29
30using namespace Cutelee;
31
32class L10nFileSizeNodeFactory : public AbstractNodeFactory
33{
35public:
36 L10nFileSizeNodeFactory();
37
38 Node *getNode(const QString &tagContent, Parser *p) const override;
39};
40
41class L10nFileSizeVarNodeFactory : public AbstractNodeFactory
42{
44public:
45 L10nFileSizeVarNodeFactory();
46
47 Node *getNode(const QString &tagContent, Parser *p) const override;
48};
49
50class L10nFileSizeNode : public Node
51{
53public:
54 L10nFileSizeNode(const FilterExpression &size,
55 const FilterExpression &unitSystem,
56 const FilterExpression &precision,
57 const FilterExpression &multiplier,
58 QObject *parent = nullptr);
59
60 void render(OutputStream *stream, Context *c) const override;
61
62private:
63 FilterExpression m_size;
64 FilterExpression m_unitSystem;
65 FilterExpression m_precision;
66 FilterExpression m_multiplier;
67};
68
69class L10nFileSizeVarNode : public Node
70{
72public:
73 L10nFileSizeVarNode(const FilterExpression &size,
74 const FilterExpression &unitSystem,
75 const FilterExpression &precision,
76 const FilterExpression &multiplier,
77 const QString &resultName,
78 QObject *parent = nullptr);
79
80 void render(OutputStream *stream, Context *c) const override;
81
82private:
83 FilterExpression m_size;
84 FilterExpression m_unitSystem;
85 FilterExpression m_precision;
86 FilterExpression m_multiplier;
87 QString m_resultName;
88};
89
90#endif
AbstractNodeFactory(QObject *parent={})
Definition node.cpp:184
The Context class holds the context to render a Template with.
Definition context.h:119
A FilterExpression object represents a filter expression in a template.
Base class for all nodes.
Definition node.h:78
Node(QObject *parent={})
Definition node.cpp:84
The OutputStream class is used to render templates to a QTextStream.
The Parser class processes a string template into a tree of nodes.
Definition parser.h:49
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
The Cutelee namespace holds all public Cutelee API.
Definition Mainpage.dox:8
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
QObject * parent() const const