Grantlee 0.1.9
|
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 00110 class GRANTLEE_CORE_EXPORT Engine : public QObject 00111 { 00112 Q_OBJECT 00113 public: 00117 Engine( QObject *parent = 0 ); 00118 00122 ~Engine(); 00123 00127 QList<AbstractTemplateLoader::Ptr> templateLoaders(); 00128 00132 void addTemplateLoader( AbstractTemplateLoader::Ptr loader ); 00133 00141 void setPluginPaths( const QStringList &dirs ); 00142 00146 void addPluginPath( const QString &dir ); 00147 00151 void removePluginPath( const QString &dir ); 00152 00156 QStringList pluginPaths() const; 00157 00168 QPair<QString, QString> mediaUri( const QString &fileName ) const; 00169 00175 Template loadByName( const QString &name ) const; 00176 00182 Template newTemplate( const QString &content, const QString &name ) const; 00183 00187 QStringList defaultLibraries() const; 00188 00192 void addDefaultLibrary( const QString &libName ); 00193 00197 void removeDefaultLibrary( const QString &libName ); 00198 00206 bool smartTrimEnabled() const; 00207 00213 void setSmartTrimEnabled( bool enabled ); 00214 00215 #ifndef Q_QDOC 00216 00221 void loadDefaultLibraries(); 00222 00230 TagLibraryInterface* loadLibrary( const QString &name ); 00231 #endif 00232 00233 private: 00234 Q_DECLARE_PRIVATE( Engine ) 00235 EnginePrivate * const d_ptr; 00236 }; 00237 00238 } 00239 00240 #endif 00241