Grantlee  5.0.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 
110 class GRANTLEE_TEMPLATES_EXPORT Engine : public QObject
111 {
112  Q_OBJECT
113 public:
117  Engine( QObject *parent = 0 );
118 
122  ~Engine();
123 
127  QList<QSharedPointer<AbstractTemplateLoader> > templateLoaders();
128 
132  void addTemplateLoader( QSharedPointer<AbstractTemplateLoader> loader );
133 
141  void setPluginPaths( const QStringList &dirs );
142 
146  void addPluginPath( const QString &dir );
147 
151  void removePluginPath( const QString &dir );
152 
156  QStringList pluginPaths() const;
157 
168  QPair<QString, QString> mediaUri( const QString &fileName ) const;
169 
175  Template loadByName( const QString &name ) const;
176 
182  Template newTemplate( const QString &content, const QString &name ) const;
183 
187  QStringList defaultLibraries() const;
188 
192  void addDefaultLibrary( const QString &libName );
193 
197  void removeDefaultLibrary( const QString &libName );
198 
206  bool smartTrimEnabled() const;
207 
213  void setSmartTrimEnabled( bool enabled );
214 
215 #ifndef Q_QDOC
216 
221  void loadDefaultLibraries();
222 
230  TagLibraryInterface* loadLibrary( const QString &name );
231 #endif
232 
233 private:
234  Q_DECLARE_PRIVATE( Engine )
235  EnginePrivate * const d_ptr;
236 };
237 
238 }
239 
240 #endif
The Template class is a tree of nodes which may be rendered.
Definition: template.h:89
The TagLibraryInterface returns available tags and filters from libraries.
The Grantlee namespace holds all public Grantlee API.
Definition: Mainpage.dox:7
Grantlee::Engine is the main entry point for creating Grantlee Templates.
Definition: engine.h:110