Grantlee: templates/lib/filter.h Source File

Grantlee 5.1.0

filter.h
1 /*
2 This file is part of the Grantlee template system.
3
4 Copyright (c) 2009,2010 Stephen Kelly <steveire@gmail.com>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either version
9 2.1 of the Licence, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library. If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21 // krazy:excludeall=dpointer
22
23 #ifndef GRANTLEE_FILTER_H
24 #define GRANTLEE_FILTER_H
25
26 #include "grantlee_templates_export.h"
27 #include "outputstream.h"
28 #include "safestring.h"
29
30 #include <QtCore/QSharedPointer>
31 #include <QtCore/QStringList>
32 #include <QtCore/QVariant>
33
34 namespace Grantlee
35 {
36
38
57 class GRANTLEE_TEMPLATES_EXPORT Filter
58 {
59 public:
63 virtual ~Filter();
64
65 #ifndef Q_QDOC
66
70 void setStream(OutputStream *stream);
71 #endif
72
77 SafeString escape(const QString &input) const;
78
83 SafeString escape(const SafeString &input) const;
84
89 SafeString conditionalEscape(const SafeString &input) const;
90
98 virtual QVariant doFilter(const QVariant &input,
99 const QVariant &argument = QVariant(),
100 bool autoescape = false) const = 0;
101
105 virtual bool isSafe() const;
106
107 private:
108 #ifndef Q_QDOC
109 OutputStream *m_stream;
110 #endif
111 };
112 }
113
114 #endif
Grantlee::Filter
Base class for all filters.
Definition: filter.h:57
Grantlee::OutputStream
The OutputStream class is used to render templates to a QTextStream.
Definition: outputstream.h:82
Grantlee::SafeString
A QString wrapper class for containing whether a string is safe or needs to be escaped.
Definition: safestring.h:92
Grantlee
The Grantlee namespace holds all public Grantlee API.
Definition: Mainpage.dox:7