Grantlee  5.1.0
templates/lib/outputstream.h
00001 /*
00002   This file is part of the Grantlee template system.
00003 
00004   Copyright (c) 2010 Stephen Kelly <steveire@gmail.com>
00005 
00006   This library is free software; you can redistribute it and/or
00007   modify it under the terms of the GNU Lesser General Public
00008   License as published by the Free Software Foundation; either version
00009   2.1 of the Licence, or (at your option) any later version.
00010 
00011   This library is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014   Lesser General Public License for more details.
00015 
00016   You should have received a copy of the GNU Lesser General Public
00017   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
00018 
00019 */
00020 
00021 #ifndef GRANTLEE_OUTPUTSTREAM_H
00022 #define GRANTLEE_OUTPUTSTREAM_H
00023 
00024 #include "grantlee_templates_export.h"
00025 
00026 #include <QtCore/QSharedPointer>
00027 #include <QtCore/QTextStream>
00028 
00029 namespace Grantlee
00030 {
00031 
00032 class SafeString;
00033 
00035 
00082 class GRANTLEE_TEMPLATES_EXPORT OutputStream
00083 {
00084 public:
00089   OutputStream();
00090 
00095   explicit OutputStream(QTextStream *stream);
00096 
00100   virtual ~OutputStream();
00101 
00106   virtual QString escape(const QString &input) const;
00107 
00112   QString escape(const SafeString &input) const;
00113 
00117   virtual QSharedPointer<OutputStream> clone(QTextStream *stream) const;
00118 
00123   QString conditionalEscape(const Grantlee::SafeString &input) const;
00124 
00128   OutputStream &operator<<(const QString &input);
00129 
00133   OutputStream &operator<<(const SafeString &input);
00134 
00139   OutputStream &operator<<(QTextStream *stream);
00140 
00141 private:
00142   QTextStream *m_stream;
00143   Q_DISABLE_COPY(OutputStream)
00144 };
00145 }
00146 
00147 #endif