Cutelee  6.1.0
outputstream.h
1 /*
2  This file is part of the Cutelee 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 CUTELEE_OUTPUTSTREAM_H
22 #define CUTELEE_OUTPUTSTREAM_H
23 
24 #include "cutelee_templates_export.h"
25 
26 #include <memory>
27 #include <QtCore/QTextStream>
28 
29 namespace Cutelee
30 {
31 
32 class SafeString;
33 
35 
80 class CUTELEE_TEMPLATES_EXPORT OutputStream
81 {
82 public:
87  OutputStream();
88 
93  explicit OutputStream(QTextStream *stream);
94 
98  virtual ~OutputStream();
99 
104  virtual QString escape(const QString &input) const;
105 
110  QString escape(const SafeString &input) const;
111 
115  virtual std::shared_ptr<OutputStream> clone(QTextStream *stream) const;
116 
121  QString conditionalEscape(const Cutelee::SafeString &input) const;
122 
126  OutputStream &operator<<(const QString &input);
127 
131  OutputStream &operator<<(const SafeString &input);
132 
137  OutputStream &operator<<(QTextStream *stream);
138 
139 private:
140  QTextStream *m_stream;
141  Q_DISABLE_COPY(OutputStream)
142 };
143 }
144 
145 #endif
The OutputStream class is used to render templates to a QTextStream.
Definition: outputstream.h:81
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