1 #ifndef __INKSCAPE_IO_STRINGSTREAM_H__
2 #define __INKSCAPE_IO_STRINGSTREAM_H__
4 #include <glibmm.h>
6 #include "inkscapestream.h"
9 namespace Inkscape
10 {
11 namespace IO
12 {
15 //#########################################################################
16 //# S T R I N G I N P U T S T R E A M
17 //#########################################################################
19 /**
20 * This class is for reading character from a Glib::ustring
21 *
22 */
23 class StringInputStream : public InputStream
24 {
26 public:
28 StringInputStream(Glib::ustring &sourceString);
30 virtual ~StringInputStream();
32 virtual int available();
34 virtual void close();
36 virtual int get();
38 private:
40 Glib::ustring &buffer;
42 long position;
44 }; // class StringInputStream
49 //#########################################################################
50 //# S T R I N G O U T P U T S T R E A M
51 //#########################################################################
53 /**
54 * This class is for sending a stream to a Glib::ustring
55 *
56 */
57 class StringOutputStream : public OutputStream
58 {
60 public:
62 StringOutputStream();
64 virtual ~StringOutputStream();
66 virtual void close();
68 virtual void flush();
70 virtual void put(int ch);
72 virtual Glib::ustring &getString()
73 { return buffer; }
75 virtual void clear()
76 { buffer = ""; }
78 private:
80 Glib::ustring buffer;
83 }; // class StringOutputStream
91 } // namespace IO
92 } // namespace Inkscape
96 #endif /* __INKSCAPE_IO_STRINGSTREAM_H__ */