1 #ifndef __STRINGSTREAM_H__
2 #define __STRINGSTREAM_H__
3 /**
4 * Phoebe DOM Implementation.
5 *
6 * This is a C++ approximation of the W3C DOM model, which follows
7 * fairly closely the specifications in the various .idl files, copies of
8 * which are provided for reference. Most important is this one:
9 *
10 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
11 *
12 * Authors:
13 * Bob Jamison
14 *
15 * Copyright (C) 2005 Bob Jamison
16 *
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License as published by the Free Software Foundation; either
20 * version 2.1 of the License, or (at your option) any later version.
21 *
22 * This library is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 * Lesser General Public License for more details.
26 *
27 * You should have received a copy of the GNU Lesser General Public
28 * License along with this library; if not, write to the Free Software
29 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 */
33 #include "domstream.h"
36 namespace org
37 {
38 namespace w3c
39 {
40 namespace dom
41 {
44 //#########################################################################
45 //# S T R I N G I N P U T S T R E A M
46 //#########################################################################
48 /**
49 * This class is for reading character from a DOMString
50 *
51 */
52 class StringInputStream : public InputStream
53 {
55 public:
57 StringInputStream(const DOMString &sourceString);
59 virtual ~StringInputStream();
61 virtual int available();
63 virtual void close();
65 virtual int get();
67 private:
69 DOMString &buffer;
71 long position;
73 }; // class StringInputStream
78 //#########################################################################
79 //# S T R I N G O U T P U T S T R E A M
80 //#########################################################################
82 /**
83 * This class is for sending a stream to a DOMString
84 *
85 */
86 class StringOutputStream : public OutputStream
87 {
89 public:
91 StringOutputStream();
93 virtual ~StringOutputStream();
95 virtual void close();
97 virtual void flush();
99 virtual void put(XMLCh ch);
101 virtual DOMString &getString()
102 { return buffer; }
104 virtual void clear()
105 { buffer = ""; }
107 private:
109 DOMString buffer;
112 }; // class StringOutputStream
120 } //namespace dom
121 } //namespace w3c
122 } //namespace org
126 #endif /* __STRINGSTREAM_H__ */