Cutelee  6.1.0
defaulttags.h
1 /*
2  This file is part of the Cutelee template system.
3 
4  Copyright (c) 2009,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.1 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  Lesser 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 DEFAULTTAGS_H
22 #define DEFAULTTAGS_H
23 
24 #include "autoescape.h"
25 #include "comment.h"
26 #include "cycle.h"
27 #include "debug.h"
28 #include "filtertag.h"
29 #include "firstof.h"
30 #include "for.h"
31 #include "if.h"
32 #include "ifchanged.h"
33 #include "ifequal.h"
34 #include "load.h"
35 #include "mediafinder.h"
36 #include "now.h"
37 #include "range.h"
38 #include "regroup.h"
39 #include "spaceless.h"
40 #include "templatetag.h"
41 #include "widthratio.h"
42 #include "with.h"
43 
44 #include "node.h"
45 #include "taglibraryinterface.h"
46 
47 namespace Cutelee
48 {
49 class Parser;
50 }
51 
52 using namespace Cutelee;
53 
54 class DefaultTagLibrary : public QObject, public TagLibraryInterface
55 {
56  Q_OBJECT
57  Q_INTERFACES(Cutelee::TagLibraryInterface)
58  Q_PLUGIN_METADATA(IID "org.cutelee.TagLibraryInterface")
59 public:
60  DefaultTagLibrary(QObject *parent = {}) : QObject(parent) {}
61 
62  QHash<QString, AbstractNodeFactory *> nodeFactories(const QString &name
63  = {}) override
64  {
65  Q_UNUSED(name);
66 
67  QHash<QString, AbstractNodeFactory *> nodeFactories;
68 
69  nodeFactories.insert(QStringLiteral("autoescape"),
70  new AutoescapeNodeFactory());
71  nodeFactories.insert(QStringLiteral("comment"), new CommentNodeFactory());
72  nodeFactories.insert(QStringLiteral("cycle"), new CycleNodeFactory());
73  nodeFactories.insert(QStringLiteral("debug"), new DebugNodeFactory());
74  nodeFactories.insert(QStringLiteral("filter"), new FilterNodeFactory());
75  nodeFactories.insert(QStringLiteral("firstof"), new FirstOfNodeFactory());
76  nodeFactories.insert(QStringLiteral("for"), new ForNodeFactory());
77  nodeFactories.insert(QStringLiteral("if"), new IfNodeFactory());
78  nodeFactories.insert(QStringLiteral("ifchanged"),
79  new IfChangedNodeFactory());
80  nodeFactories.insert(QStringLiteral("ifequal"), new IfEqualNodeFactory());
81  nodeFactories.insert(QStringLiteral("ifnotequal"),
82  new IfNotEqualNodeFactory());
83  nodeFactories.insert(QStringLiteral("load"), new LoadNodeFactory());
84  nodeFactories.insert(QStringLiteral("media_finder"),
86  nodeFactories.insert(QStringLiteral("now"), new NowNodeFactory());
87  nodeFactories.insert(QStringLiteral("range"), new RangeNodeFactory());
88  nodeFactories.insert(QStringLiteral("regroup"), new RegroupNodeFactory());
89  nodeFactories.insert(QStringLiteral("spaceless"),
90  new SpacelessNodeFactory());
91  nodeFactories.insert(QStringLiteral("templatetag"),
93  nodeFactories.insert(QStringLiteral("widthratio"),
94  new WidthRatioNodeFactory());
95  nodeFactories.insert(QStringLiteral("with"), new WithNodeFactory());
96 
97  return nodeFactories;
98  }
99 };
100 
101 #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: defaulttags.h:62
The Cutelee namespace holds all public Cutelee API.
Definition: Mainpage.dox:8