1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 //=============================================================================
24 //
25 // Class for writing plain text to the stream
26 //
27 //=============================================================================
28 
29 #ifndef AGS_SHARED_UTIL_TEXT_STREAM_WRITER_H
30 #define AGS_SHARED_UTIL_TEXT_STREAM_WRITER_H
31 
32 #include "ags/shared/util/text_writer.h"
33 
34 namespace AGS3 {
35 namespace AGS {
36 namespace Shared {
37 
38 class Stream;
39 
40 class TextStreamWriter : public TextWriter {
41 public:
42 	// TODO: use shared ptr
43 	TextStreamWriter(Stream *stream);
44 	~TextStreamWriter() override;
45 
46 	bool    IsValid() const override;
47 	const Stream *GetStream() const;
48 	// TODO: use shared ptr instead
49 	void            ReleaseStream();
50 
51 	bool            EOS() const;
52 
53 	// Write single character
54 	void    WriteChar(char c) override;
55 	// Write string as a plain text (without null-terminator)
56 	void    WriteString(const String &str) override;
57 	// Write string and add line break at the end
58 	void    WriteLine(const String &str) override;
59 	// Write formatted string (see *printf)
60 	void    WriteFormat(const char *fmt, ...) override;
61 	void    WriteLineBreak() override;
62 
63 private:
64 	Stream *_stream;
65 };
66 
67 } // namespace Shared
68 } // namespace AGS
69 } // namespace AGS3
70 
71 #endif
72