Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
stringstream.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
/*
5 * Authors: see git history
6 *
7 * Copyright (C) 2018 Authors
8 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
9 */
10#ifndef SEEN_INKSCAPE_IO_STRINGSTREAM_H
11#define SEEN_INKSCAPE_IO_STRINGSTREAM_H
12
13#include <glibmm/ustring.h>
14
15#include "inkscapestream.h"
16
17
18namespace Inkscape
19{
20namespace IO
21{
22
23
24//#########################################################################
25//# S T R I N G I N P U T S T R E A M
26//#########################################################################
27
33{
34
35public:
36
37 StringInputStream(Glib::ustring &sourceString);
38
40
41 int available() override;
42
43 void close() override;
44
45 int get() override;
46
47private:
48
49 Glib::ustring &buffer;
50
52
53}; // class StringInputStream
54
55
56
57
58//#########################################################################
59//# S T R I N G O U T P U T S T R E A M
60//#########################################################################
61
67{
68
69public:
70
72
74
75 void close() override;
76
77 void flush() override;
78
79 int put(char ch) override;
80
81 virtual Glib::ustring &getString()
82 { return buffer; }
83
84 virtual void clear()
85 { buffer = ""; }
86
87private:
88
89 Glib::ustring buffer;
90
91
92}; // class StringOutputStream
93
94
95
96
97
98
99
100} // namespace IO
101} // namespace Inkscape
102
103
104
105#endif // SEEN_INKSCAPE_IO_STRINGSTREAM_H
This interface is the base of all input stream classes.
This interface is the base of all input stream classes.
This class is for reading character from a Glib::ustring.
int available() override
Returns the number of bytes that can be read (or skipped over) from this input stream without blockin...
int get() override
Reads the next byte of data from the input stream.
void close() override
Closes this input stream and releases any system resources associated with the stream.
This class is for sending a stream to a Glib::ustring.
void close() override
Closes this output stream and releases any system resources associated with this stream.
virtual Glib::ustring & getString()
int put(char ch) override
Writes the specified byte to this output stream.
void flush() override
Flushes this output stream and forces any buffered output bytes to be written out.
Helper class to stream background task notifications as a series of messages.