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 
25 namespace Cutelee
26 {
27  class Parser;
28 }
29 
30 using namespace Cutelee;
31 
33 {
34  Q_OBJECT
35 public:
37 
38  Node *getNode(const QString &tagContent, Parser *p) const override;
39 };
40 
42 {
43  Q_OBJECT
44 public:
46 
47  Node *getNode(const QString &tagContent, Parser *p) const override;
48 };
49 
50 class L10nFileSizeNode : public Node
51 {
52  Q_OBJECT
53 public:
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 
62 private:
63  FilterExpression m_size;
64  FilterExpression m_unitSystem;
65  FilterExpression m_precision;
66  FilterExpression m_multiplier;
67 };
68 
69 class L10nFileSizeVarNode : public Node
70 {
71  Q_OBJECT
72 public:
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 
82 private:
83  FilterExpression m_size;
84  FilterExpression m_unitSystem;
85  FilterExpression m_precision;
86  FilterExpression m_multiplier;
87  QString m_resultName;
88 };
89 
90 #endif
Base class for all NodeFactories.
Definition: node.h:300
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
The OutputStream class is used to render templates to a QTextStream.
Definition: outputstream.h:81
The Parser class processes a string template into a tree of nodes.
Definition: parser.h:49
The Cutelee namespace holds all public Cutelee API.
Definition: Mainpage.dox:8