Grantlee  0.4.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_core_export.h"
25 
26 #include <QtCore/QSharedPointer>
27 #include <QtCore/QTextStream>
28 
29 namespace Grantlee
30 {
31 
32 class SafeString;
33 
35 
76 class GRANTLEE_CORE_EXPORT OutputStream
77 {
78 public:
82  OutputStream();
83 
87  explicit OutputStream( QTextStream *stream );
88 
92  virtual ~OutputStream();
93 
97  virtual QString escape( const QString &input ) const;
98 
102  QString escape( const SafeString &input ) const;
103 
107  virtual QSharedPointer<OutputStream> clone( QTextStream *stream ) const;
108 
112  QString conditionalEscape( const Grantlee::SafeString &input ) const;
113 
117  OutputStream& operator<<( const QString &input );
118 
122  OutputStream& operator<<( const SafeString &input );
123 
127  OutputStream& operator<<( QTextStream *stream );
128 
129 private:
130  QTextStream *m_stream;
131  Q_DISABLE_COPY( OutputStream )
132 };
133 
134 }
135 
136 #endif
The OutputStream class is used to render templates to a QTextStream.
Definition: outputstream.h:76
A QString wrapper class for containing whether a string is safe or needs to be escaped.
Definition: safestring.h:73