|
Grantlee
5.1.0
|
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_TEMPLATE_H 00022 #define GRANTLEE_TEMPLATE_H 00023 00024 #include "exception.h" 00025 #include "grantlee_templates_export.h" 00026 #include "node.h" 00027 00028 #include <QtCore/QSharedPointer> 00029 #include <QtCore/QStringList> 00030 00031 namespace Grantlee 00032 { 00033 class Context; 00034 class Engine; 00035 class TemplateImpl; 00036 class OutputStream; 00037 00038 #ifdef Q_QDOC 00039 #define TemplateImpl Template 00040 #else 00041 typedef QSharedPointer<TemplateImpl> Template; 00042 #endif 00043 00044 class TemplatePrivate; 00045 00047 00094 class GRANTLEE_TEMPLATES_EXPORT TemplateImpl : public QObject 00095 { 00096 Q_OBJECT 00097 public: 00098 ~TemplateImpl() override; 00099 00103 QString render(Context *c) const; 00104 00108 OutputStream *render(OutputStream *stream, Context *c) const; 00109 00110 #ifndef Q_QDOC 00111 00114 NodeList nodeList() const; 00115 00119 void setNodeList(const NodeList &list); 00120 #endif 00121 00125 Error error() const; 00126 00130 QString errorString() const; 00131 00135 Engine const *engine() const; 00136 00137 #ifndef Q_QDOC 00138 protected: 00139 TemplateImpl(Engine const *engine, QObject *parent = 0); 00140 TemplateImpl(Engine const *engine, bool smartTrim, QObject *parent = 0); 00141 00142 void setContent(const QString &templateString); 00143 #endif 00144 00145 private: 00146 // Don't allow setting the parent on a Template, which is memory managed as 00147 // a 00148 // QSharedPointer. 00149 using QObject::setParent; 00150 00151 private: 00152 Q_DECLARE_PRIVATE(Template) 00153 TemplatePrivate *const d_ptr; 00154 #ifndef Q_QDOC 00155 friend class Engine; 00156 friend class Parser; 00157 #endif 00158 }; 00159 } 00160 00161 #endif
1.7.6.1