Grantlee  5.1.0
templates/lib/filterexpression.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_FILTEREXPRESSION_H
00022 #define GRANTLEE_FILTEREXPRESSION_H
00023 
00024 #include "variable.h"
00025 
00026 #include "grantlee_templates_export.h"
00027 
00028 namespace Grantlee
00029 {
00030 class Filter;
00031 class OutputStream;
00032 class Parser;
00033 struct Token;
00034 
00035 class FilterExpressionPrivate;
00036 
00038 
00118 class GRANTLEE_TEMPLATES_EXPORT FilterExpression
00119 {
00120 public:
00124   FilterExpression();
00125 
00130   FilterExpression(const QString &varString, Grantlee::Parser *parser);
00131 
00135   FilterExpression(const FilterExpression &other);
00136 
00140   ~FilterExpression();
00141 
00145   FilterExpression &operator=(const FilterExpression &other);
00146 
00150   Variable variable() const;
00151 
00156   QVariant resolve(OutputStream *stream, Context *c) const;
00157 
00161   QVariant resolve(Context *c) const;
00162 
00167   bool isTrue(Context *c) const;
00168 
00175   QVariantList toList(Context *c) const;
00176 
00183   bool isValid() const;
00184 
00185 #ifndef Q_QDOC
00186 
00190   QStringList filters() const;
00191 #endif
00192 
00193 private:
00194   Q_DECLARE_PRIVATE(FilterExpression)
00195   FilterExpressionPrivate *const d_ptr;
00196 };
00197 }
00198 
00199 #endif