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_PARSER_H 00022 #define GRANTLEE_PARSER_H 00023 00024 #include "filter.h" 00025 #include "node.h" 00026 #include "token.h" 00027 00028 #include <QtCore/QStringList> 00029 00030 namespace Grantlee 00031 { 00032 class TemplateImpl; 00033 00034 class ParserPrivate; 00035 00037 00048 class GRANTLEE_CORE_EXPORT Parser : public QObject 00049 { 00050 Q_OBJECT 00051 public: 00057 Parser( const QList<Token> &tokenList, QObject *parent ); 00058 00062 ~Parser(); 00063 00064 #ifndef Q_QDOC 00065 00070 void setTokens( const QList<Token> &tokenList ); 00071 #endif 00072 00082 NodeList parse( Node *parent, const QStringList &stopAt = QStringList() ); 00083 00088 NodeList parse( TemplateImpl *parent, const QStringList &stopAt = QStringList() ); 00089 00094 NodeList parse( Node *parent, const QString &stopAt ); 00095 00099 Filter::Ptr getFilter( const QString &name ) const; 00100 00105 void skipPast( const QString &tag ); 00106 00114 Token takeNextToken(); 00115 00119 bool hasNextToken() const; 00120 00124 void removeNextToken(); 00125 00126 #ifndef Q_QDOC 00127 00132 void loadLib( const QString &name ); 00133 #endif 00134 00135 protected: 00139 void prependToken( const Token &token ); 00140 00141 private: 00142 Q_DECLARE_PRIVATE( Parser ) 00143 ParserPrivate * const d_ptr; 00144 00145 }; 00146 00147 } 00148 00149 #endif 00150