Grantlee  5.1.0
templates/lib/engine.h
00001 /*
00002   This file is part of the Grantlee template system.
00003 
00004   Copyright (c) 2009,2010 Stephen Kelly <steveire@gmail.com>
00005 
00006   This library is free software; you can redistribute it and/or
00007   modify it under the terms of the GNU Lesser General Public
00008   License as published by the Free Software Foundation; either version
00009   2.1 of the Licence, or (at your option) any later version.
00010 
00011   This library is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014   Lesser General Public License for more details.
00015 
00016   You should have received a copy of the GNU Lesser General Public
00017   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
00018 
00019 */
00020 
00021 #ifndef GRANTLEE_ENGINE_H
00022 #define GRANTLEE_ENGINE_H
00023 
00024 #include "template.h"
00025 #include "templateloader.h"
00026 
00027 namespace Grantlee
00028 {
00029 class TagLibraryInterface;
00030 
00031 class EnginePrivate;
00032 
00034 
00123 class GRANTLEE_TEMPLATES_EXPORT Engine : public QObject
00124 {
00125   Q_OBJECT
00126 public:
00130   Engine(QObject *parent = 0);
00131 
00135   ~Engine() override;
00136 
00140   QList<QSharedPointer<AbstractTemplateLoader>> templateLoaders();
00141 
00145   void addTemplateLoader(QSharedPointer<AbstractTemplateLoader> loader);
00146 
00155   void setPluginPaths(const QStringList &dirs);
00156 
00160   void addPluginPath(const QString &dir);
00161 
00165   void removePluginPath(const QString &dir);
00166 
00170   QStringList pluginPaths() const;
00171 
00185   QPair<QString, QString> mediaUri(const QString &fileName) const;
00186 
00193   Template loadByName(const QString &name) const;
00194 
00202   Template newTemplate(const QString &content, const QString &name) const;
00203 
00207   QStringList defaultLibraries() const;
00208 
00213   void addDefaultLibrary(const QString &libName);
00214 
00220   void removeDefaultLibrary(const QString &libName);
00221 
00230   bool smartTrimEnabled() const;
00231 
00237   void setSmartTrimEnabled(bool enabled);
00238 
00239 #ifndef Q_QDOC
00240 
00245   void loadDefaultLibraries();
00246 
00255   TagLibraryInterface *loadLibrary(const QString &name);
00256 #endif
00257 
00258 private:
00259   Q_DECLARE_PRIVATE(Engine)
00260   EnginePrivate *const d_ptr;
00261 };
00262 }
00263 
00264 #endif