/usr/include/grantlee/parser.h is in libgrantlee-dev 0.4.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | /*
This file is part of the Grantlee template system.
Copyright (c) 2009,2010 Stephen Kelly <steveire@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either version
2.1 of the Licence, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRANTLEE_PARSER_H
#define GRANTLEE_PARSER_H
#include "filter.h"
#include "node.h"
#include "token.h"
#include <QtCore/QStringList>
namespace Grantlee
{
class TemplateImpl;
class ParserPrivate;
/// @headerfile parser.h grantlee/parser.h
/**
@brief The Parser class processes a string template into a tree of nodes.
For application developers, this class is internal.
For template tag authors it may be necessary to advance the parser and process contained tags if
the tag works in a tag -- endtag fashion.
@author Stephen Kelly <steveire@gmail.com>
*/
class GRANTLEE_CORE_EXPORT Parser : public QObject
{
Q_OBJECT
public:
/**
Constructor.
Initialises the Parser with the @p tokenList.
*/
Parser( const QList<Token> &tokenList, QObject *parent );
/**
Destructor.
*/
~Parser();
#ifndef Q_QDOC
/**
@internal
Sets the tokens for this object to parse.
*/
void setTokens( const QList<Token> &tokenList );
#endif
/**
Advance the parser, using @p parent as the parent of new Nodes. The parser will stop
if it encounters a tag which is contained in the list @p stopAt.
For example, the @gr_tag{if} tag would stopAt both @gr_tag{endif} and @gr_tag{else} tags.
@see AbstractNodeFactory::getNode
*/
NodeList parse( Node *parent, const QStringList &stopAt = QStringList() );
/**
This is an overloaded method.
@see parse.
*/
NodeList parse( TemplateImpl *parent, const QStringList &stopAt = QStringList() );
/**
This is an overloaded method.
@see parse.
*/
NodeList parse( Node *parent, const QString &stopAt );
/**
Returns the filter object called @p name or an invalid object if no filter with that name is loaded.
*/
Filter::Ptr getFilter( const QString &name ) const;
/**
Advances the parser to the tag @p tag. This method is similar to parse, but it does not create
nodes for tags encountered.
*/
void skipPast( const QString &tag );
/**
Returns the next token to be processed by the parser. This can be examined in template tag implementations to
determine why parsing stopped.
For example, if the @gr_tag{if} tag, parsing may stop at an @gr_tag{else} tag, in which case parsing
should be restarted, or it could stop at an @gr_tag{endif} tag, in which case parsing is finished for that node.
*/
Token takeNextToken();
/**
Returns whether the parser has another token to process.
*/
bool hasNextToken() const;
/**
Deletes the next token available to the parser.
*/
void removeNextToken();
#ifndef Q_QDOC
/**
@internal
Used by the @gr_tag{load} tag to load libraries.
*/
void loadLib( const QString &name );
#endif
protected:
/**
Puts the token @p token to the front of the list to be processed by the parser.
*/
void prependToken( const Token &token );
private:
Q_DECLARE_PRIVATE( Parser )
ParserPrivate * const d_ptr;
};
}
#endif
|