Code

Translations. French translation minor update.
[inkscape.git] / src / io / stringstream.cpp
1 /**
2  * Our base String stream classes.  We implement these to
3  * be based on Glib::ustring
4  *
5  * Authors:
6  *   Bob Jamison <rjamison@titan.com>
7  *
8  * Copyright (C) 2004 Inkscape.org
9  *
10  * Released under GNU GPL, read the file 'COPYING' for more information
11  */
14 #include "stringstream.h"
16 namespace Inkscape
17 {
18 namespace IO
19 {
22 //#########################################################################
23 //# S T R I N G    I N P U T    S T R E A M
24 //#########################################################################
27 /**
28  *
29  */ 
30 StringInputStream::StringInputStream(Glib::ustring &sourceString)
31                       : buffer(sourceString)
32 {
33     position = 0;
34 }
36 /**
37  *
38  */ 
39 StringInputStream::~StringInputStream()
40 {
42 }
44 /**
45  * Returns the number of bytes that can be read (or skipped over) from
46  * this input stream without blocking by the next caller of a method for
47  * this input stream.
48  */ 
49 int StringInputStream::available()
50 {
51     return buffer.size() - position;
52 }
54     
55 /**
56  *  Closes this input stream and releases any system resources
57  *  associated with the stream.
58  */ 
59 void StringInputStream::close()
60 {
61 }
62     
63 /**
64  * Reads the next byte of data from the input stream.  -1 if EOF
65  */ 
66 int StringInputStream::get()
67 {
68     if (position >= (int)buffer.size())
69         return -1;
70     int ch = (int) buffer[position++];
71     return ch;
72 }
73    
77 //#########################################################################
78 //# S T R I N G     O U T P U T    S T R E A M
79 //#########################################################################
81 /**
82  *
83  */ 
84 StringOutputStream::StringOutputStream()
85 {
86 }
88 /**
89  *
90  */ 
91 StringOutputStream::~StringOutputStream()
92 {
93 }
95 /**
96  * Closes this output stream and releases any system resources
97  * associated with this stream.
98  */ 
99 void StringOutputStream::close()
102     
103 /**
104  *  Flushes this output stream and forces any buffered output
105  *  bytes to be written out.
106  */ 
107 void StringOutputStream::flush()
109     //nothing to do
111     
112 /**
113  * Writes the specified byte to this output stream.
114  */ 
115 void StringOutputStream::put(int ch)
117     gunichar uch = (gunichar)ch;
118     buffer.push_back(uch);
122 } // namespace IO
123 } // namespace Inkscape
126 //#########################################################################
127 //# E N D    O F    F I L E
128 //#########################################################################