2
* Phoebe DOM Implementation.
4
* This is a C++ approximation of the W3C DOM model, which follows
5
* fairly closely the specifications in the various .idl files, copies of
6
* which are provided for reference. Most important is this one:
8
* http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
13
* Copyright (C) 2005 Bob Jamison
15
* This library is free software; you can redistribute it and/or
16
* modify it under the terms of the GNU Lesser General Public
17
* License as published by the Free Software Foundation; either
18
* version 2.1 of the License, or (at your option) any later version.
20
* This library is distributed in the hope that it will be useful,
21
* but WITHOUT ANY WARRANTY; without even the implied warranty of
22
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23
* Lesser General Public License for more details.
25
* You should have received a copy of the GNU Lesser General Public
26
* License along with this library; if not, write to the Free Software
27
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31
* Our base String stream classes. We implement these to
32
* be based on DOMString
37
#include "stringstream.h"
50
//#########################################################################
51
//# S T R I N G I N P U T S T R E A M
52
//#########################################################################
58
StringInputStream::StringInputStream(const DOMString &sourceString)
59
: buffer((DOMString &)sourceString)
67
StringInputStream::~StringInputStream()
73
* Returns the number of bytes that can be read (or skipped over) from
74
* this input stream without blocking by the next caller of a method for
77
int StringInputStream::available()
79
return buffer.size() - position;
84
* Closes this input stream and releases any system resources
85
* associated with the stream.
87
void StringInputStream::close()
92
* Reads the next byte of data from the input stream. -1 if EOF
94
int StringInputStream::get()
96
if (position >= (int)buffer.size())
98
int ch = (int) buffer[position++];
105
//#########################################################################
106
//# S T R I N G O U T P U T S T R E A M
107
//#########################################################################
112
StringOutputStream::StringOutputStream()
119
StringOutputStream::~StringOutputStream()
124
* Closes this output stream and releases any system resources
125
* associated with this stream.
127
void StringOutputStream::close()
132
* Flushes this output stream and forces any buffered output
133
* bytes to be written out.
135
void StringOutputStream::flush()
141
* Writes the specified byte to this output stream.
143
int StringOutputStream::put(XMLCh ch)
145
buffer.push_back(ch);
157
//#########################################################################
158
//# E N D O F F I L E
159
//#########################################################################