Grantlee  5.2.0
engine.h
1 /*
2  This file is part of the Grantlee 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 GRANTLEE_ENGINE_H
22 #define GRANTLEE_ENGINE_H
23 
24 #include "template.h"
25 #include "templateloader.h"
26 
27 namespace Grantlee
28 {
29 class TagLibraryInterface;
30 
31 class EnginePrivate;
32 
34 
120 class GRANTLEE_TEMPLATES_EXPORT Engine : public QObject
121 {
122  Q_OBJECT
123 public:
127  Engine(QObject *parent = {});
128 
132  ~Engine() override;
133 
137  QList<QSharedPointer<AbstractTemplateLoader>> templateLoaders();
138 
143  void addTemplateLoader(QSharedPointer<AbstractTemplateLoader> loader);
144 
153  void setPluginPaths(const QStringList &dirs);
154 
158  void addPluginPath(const QString &dir);
159 
163  void removePluginPath(const QString &dir);
164 
168  QStringList pluginPaths() const;
169 
182  QPair<QString, QString> mediaUri(const QString &fileName) const;
183 
190  Template loadByName(const QString &name) const;
191 
198  Template newTemplate(const QString &content, const QString &name) const;
199 
203  QStringList defaultLibraries() const;
204 
209  void addDefaultLibrary(const QString &libName);
210 
215  void removeDefaultLibrary(const QString &libName);
216 
225  bool smartTrimEnabled() const;
226 
232  void setSmartTrimEnabled(bool enabled);
233 
234 #ifndef Q_QDOC
235 
240  void loadDefaultLibraries();
241 
250  TagLibraryInterface *loadLibrary(const QString &name);
251 #endif
252 
253 private:
254  Q_DECLARE_PRIVATE(Engine)
255  EnginePrivate *const d_ptr;
256 };
257 }
258 
259 #endif
Grantlee::Engine::setSmartTrimEnabled
void setSmartTrimEnabled(bool enabled)
Grantlee::Engine::addDefaultLibrary
void addDefaultLibrary(const QString &libName)
Grantlee::Engine::loadByName
Template loadByName(const QString &name) const
Grantlee::Engine::removePluginPath
void removePluginPath(const QString &dir)
Grantlee::Engine
Grantlee::Engine is the main entry point for creating Grantlee Templates.
Definition: engine.h:121
Grantlee::Engine::defaultLibraries
QStringList defaultLibraries() const
Grantlee::Engine::pluginPaths
QStringList pluginPaths() const
Grantlee::TagLibraryInterface
The TagLibraryInterface returns available tags and filters from libraries.
Definition: taglibraryinterface.h:79
Grantlee::Engine::newTemplate
Template newTemplate(const QString &content, const QString &name) const
Grantlee::Engine::smartTrimEnabled
bool smartTrimEnabled() const
Grantlee::Engine::removeDefaultLibrary
void removeDefaultLibrary(const QString &libName)
Grantlee::Template
The Template class is a tree of nodes which may be rendered.
Definition: template.h:96
Grantlee::Engine::addTemplateLoader
void addTemplateLoader(QSharedPointer< AbstractTemplateLoader > loader)
Grantlee::Engine::~Engine
~Engine() override
Grantlee::Engine::addPluginPath
void addPluginPath(const QString &dir)
Grantlee::Engine::templateLoaders
QList< QSharedPointer< AbstractTemplateLoader > > templateLoaders()
Grantlee
The Grantlee namespace holds all public Grantlee API.
Definition: Mainpage.dox:8
Grantlee::Engine::Engine
Engine(QObject *parent={})
Grantlee::Engine::setPluginPaths
void setPluginPaths(const QStringList &dirs)
Grantlee::Engine::mediaUri
QPair< QString, QString > mediaUri(const QString &fileName) const