Cutelee 6.1.0
filter.h
1/*
2 This file is part of the Cutelee 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 CUTELEE_FILTER_H
24#define CUTELEE_FILTER_H
25
26#include "cutelee_templates_export.h"
27#include "outputstream.h"
28#include "safestring.h"
29
30#include <QtCore/QStringList>
31#include <QtCore/QVariant>
32
33namespace Cutelee
34{
35
37
58class CUTELEE_TEMPLATES_EXPORT Filter
59{
60public:
64 virtual ~Filter();
65
66#ifndef Q_QDOC
71 void setStream(OutputStream *stream);
72#endif
73
78 SafeString escape(const QString &input) const;
79
84 SafeString escape(const SafeString &input) const;
85
90 SafeString conditionalEscape(const SafeString &input) const;
91
100 virtual QVariant doFilter(const QVariant &input,
101 const QVariant &argument = {},
102 bool autoescape = {}) const = 0;
103
107 virtual bool isSafe() const;
108
109private:
110#ifndef Q_QDOC
111 OutputStream *m_stream;
112#endif
113};
114}
115
116#endif
Base class for all filters.
Definition filter.h:59
virtual QVariant doFilter(const QVariant &input, const QVariant &argument={}, bool autoescape={}) const =0
The OutputStream class is used to render templates to a QTextStream.
A QString wrapper class for containing whether a string is safe or needs to be escaped.
Definition safestring.h:92
The Cutelee namespace holds all public Cutelee API.
Definition Mainpage.dox:8