Grantlee  5.1.0
outputstream.h
1 /*
2  This file is part of the Grantlee template system.
3 
4  Copyright (c) 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 #ifndef GRANTLEE_OUTPUTSTREAM_H
22 #define GRANTLEE_OUTPUTSTREAM_H
23 
24 #include "grantlee_templates_export.h"
25 
26 #include <QtCore/QSharedPointer>
27 #include <QtCore/QTextStream>
28 
29 namespace Grantlee
30 {
31 
32 class SafeString;
33 
35 
82 class GRANTLEE_TEMPLATES_EXPORT OutputStream
83 {
84 public:
89  OutputStream();
90 
95  explicit OutputStream(QTextStream *stream);
96 
100  virtual ~OutputStream();
101 
106  virtual QString escape(const QString &input) const;
107 
112  QString escape(const SafeString &input) const;
113 
117  virtual QSharedPointer<OutputStream> clone(QTextStream *stream) const;
118 
123  QString conditionalEscape(const Grantlee::SafeString &input) const;
124 
128  OutputStream &operator<<(const QString &input);
129 
133  OutputStream &operator<<(const SafeString &input);
134 
139  OutputStream &operator<<(QTextStream *stream);
140 
141 private:
142  QTextStream *m_stream;
143  Q_DISABLE_COPY(OutputStream)
144 };
145 }
146 
147 #endif
The OutputStream class is used to render templates to a QTextStream.
Definition: outputstream.h:82
A QString wrapper class for containing whether a string is safe or needs to be escaped.
Definition: safestring.h:92
The Grantlee namespace holds all public Grantlee API.
Definition: Mainpage.dox:7