Grantlee  0.5.1
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_core_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 
00105 class GRANTLEE_CORE_EXPORT FilterExpression
00106 {
00107 public:
00111   FilterExpression();
00112 
00116   FilterExpression( const QString &varString, Grantlee::Parser *parser );
00117 
00121   FilterExpression( const FilterExpression &other );
00122 
00126   ~FilterExpression();
00127 
00131   FilterExpression &operator=( const FilterExpression &other );
00132 
00136   Variable variable() const;
00137 
00141   QVariant resolve( OutputStream *stream, Context *c ) const;
00142 
00146   QVariant resolve( Context *c ) const;
00147 
00152   bool isTrue( Context *c ) const;
00153 
00158   QVariantList toList( Context *c ) const;
00159 
00165   bool isValid() const;
00166 
00167 #ifndef Q_QDOC
00168 
00172   QStringList filters() const;
00173 #endif
00174 
00175 private:
00176   Q_DECLARE_PRIVATE( FilterExpression )
00177   FilterExpressionPrivate * const d_ptr;
00178 };
00179 
00180 }
00181 
00182 #endif