Cutelee  6.1.0
i18ntags.h
1 /*
2  This file is part of the Cutelee template system.
3 
4  Copyright (c) 2010 Stephen Kelly <steveire@gmail.com>
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 
21 #ifndef I18N_TAGS_H
22 #define I18N_TAGS_H
23 
24 #include "taglibraryinterface.h"
25 
26 #include "i18n.h"
27 #include "i18nc.h"
28 #include "i18ncp.h"
29 #include "i18np.h"
30 #include "l10n_money.h"
31 #include "l10n_filesize.h"
32 #include "with_locale.h"
33 
34 namespace Cutelee
35 {
36 class Parser;
37 }
38 
39 using namespace Cutelee;
40 
41 class I18nTagLibrary : public QObject, public TagLibraryInterface
42 {
43  Q_OBJECT
44  Q_INTERFACES(Cutelee::TagLibraryInterface)
45  Q_PLUGIN_METADATA(IID "org.cutelee.TagLibraryInterface")
46 public:
47  I18nTagLibrary() {}
48 
49  QHash<QString, AbstractNodeFactory *> nodeFactories(const QString &name
50  = {}) override
51  {
52  Q_UNUSED(name);
53 
54  QHash<QString, AbstractNodeFactory *> nodeFactories;
55  nodeFactories.insert(QStringLiteral("i18n"), new I18nNodeFactory());
56  nodeFactories.insert(QStringLiteral("i18n_var"), new I18nVarNodeFactory());
57  nodeFactories.insert(QStringLiteral("i18nc"), new I18ncNodeFactory());
58  nodeFactories.insert(QStringLiteral("i18nc_var"),
59  new I18ncVarNodeFactory());
60  nodeFactories.insert(QStringLiteral("i18np"), new I18npNodeFactory());
61  nodeFactories.insert(QStringLiteral("i18np_var"),
62  new I18npVarNodeFactory());
63  nodeFactories.insert(QStringLiteral("i18ncp"), new I18ncpNodeFactory());
64  nodeFactories.insert(QStringLiteral("i18ncp_var"),
65  new I18ncpVarNodeFactory());
66  nodeFactories.insert(QStringLiteral("l10n_money"),
67  new L10nMoneyNodeFactory());
68  nodeFactories.insert(QStringLiteral("l10n_money_var"),
70  nodeFactories.insert(QStringLiteral("l10n_filesize"),
72  nodeFactories.insert(QStringLiteral("l10n_filesize_var"),
74  nodeFactories.insert(QStringLiteral("with_locale"),
75  new WithLocaleNodeFactory());
76  // TODO: Compat and block tags
77  return nodeFactories;
78  }
79 };
80 
81 #endif
The Parser class processes a string template into a tree of nodes.
Definition: parser.h:49
The TagLibraryInterface returns available tags and filters from libraries.
QHash< QString, AbstractNodeFactory * > nodeFactories(const QString &name={}) override
Definition: i18ntags.h:49
The Cutelee namespace holds all public Cutelee API.
Definition: Mainpage.dox:8