Grantlee: templates/lib/filter.h Source File

Grantlee 5.3.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
34namespace Grantlee
35{
36
38
59 class GRANTLEE_TEMPLATES_EXPORT Filter
60{
61public:
65 virtual ~Filter();
66
67#ifndef Q_QDOC
72 void setStream(OutputStream *stream);
73#endif
74
79 SafeString escape(const QString &input) const;
80
85 SafeString escape(const SafeString &input) const;
86
91 SafeString conditionalEscape(const SafeString &input) const;
92
101 virtual QVariant doFilter(const QVariant &input,
102 const QVariant &argument = {},
103 bool autoescape = {}) const = 0;
104
108 virtual bool isSafe() const;
109
110private:
111#ifndef Q_QDOC
112 OutputStream *m_stream;
113#endif
114};
115}
116
117#endif
Grantlee::Filter
Base class for all filters.
Definition filter.h:60
Grantlee::Filter::isSafe
virtual bool isSafe() const
Grantlee::Filter::escape
SafeString escape(const SafeString &input) const
Grantlee::Filter::conditionalEscape
SafeString conditionalEscape(const SafeString &input) const
Grantlee::Filter::doFilter
virtual QVariant doFilter(const QVariant &input, const QVariant &argument={}, bool autoescape={}) const =0
Grantlee::Filter::~Filter
virtual ~Filter()
Grantlee::Filter::escape
SafeString escape(const QString &input) const
Grantlee::OutputStream
The OutputStream class is used to render templates to a QTextStream.
Definition outputstream.h:81
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:8