~ubuntu-branches/ubuntu/utopic/inkscape/utopic-proposed

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/src/dom/io/stringstream.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * Phoebe DOM Implementation.
 
3
 *
 
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:
 
7
 *
 
8
 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
 
9
 *
 
10
 * Authors:
 
11
 *   Bob Jamison
 
12
 *
 
13
 * Copyright (C) 2005 Bob Jamison
 
14
 *
 
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.
 
19
 *
 
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.
 
24
 *
 
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
 
28
 */
 
29
 
 
30
/**
 
31
 * Our base String stream classes.  We implement these to
 
32
 * be based on DOMString
 
33
 *
 
34
 */
 
35
 
 
36
 
 
37
#include "stringstream.h"
 
38
 
 
39
namespace org
 
40
{
 
41
namespace w3c
 
42
{
 
43
namespace dom
 
44
{
 
45
namespace io
 
46
{
 
47
 
 
48
 
 
49
 
 
50
//#########################################################################
 
51
//# S T R I N G    I N P U T    S T R E A M
 
52
//#########################################################################
 
53
 
 
54
 
 
55
/**
 
56
 *
 
57
 */
 
58
StringInputStream::StringInputStream(const DOMString &sourceString)
 
59
                      : buffer((DOMString &)sourceString)
 
60
{
 
61
    position = 0;
 
62
}
 
63
 
 
64
/**
 
65
 *
 
66
 */
 
67
StringInputStream::~StringInputStream()
 
68
{
 
69
 
 
70
}
 
71
 
 
72
/**
 
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
 
75
 * this input stream.
 
76
 */
 
77
int StringInputStream::available()
 
78
{
 
79
    return buffer.size() - position;
 
80
}
 
81
 
 
82
 
 
83
/**
 
84
 *  Closes this input stream and releases any system resources
 
85
 *  associated with the stream.
 
86
 */
 
87
void StringInputStream::close()
 
88
{
 
89
}
 
90
 
 
91
/**
 
92
 * Reads the next byte of data from the input stream.  -1 if EOF
 
93
 */
 
94
int StringInputStream::get()
 
95
{
 
96
    if (position >= (int)buffer.size())
 
97
        return -1;
 
98
    int ch = (int) buffer[position++];
 
99
    return ch;
 
100
}
 
101
 
 
102
 
 
103
 
 
104
 
 
105
//#########################################################################
 
106
//# S T R I N G     O U T P U T    S T R E A M
 
107
//#########################################################################
 
108
 
 
109
/**
 
110
 *
 
111
 */
 
112
StringOutputStream::StringOutputStream()
 
113
{
 
114
}
 
115
 
 
116
/**
 
117
 *
 
118
 */
 
119
StringOutputStream::~StringOutputStream()
 
120
{
 
121
}
 
122
 
 
123
/**
 
124
 * Closes this output stream and releases any system resources
 
125
 * associated with this stream.
 
126
 */
 
127
void StringOutputStream::close()
 
128
{
 
129
}
 
130
 
 
131
/**
 
132
 *  Flushes this output stream and forces any buffered output
 
133
 *  bytes to be written out.
 
134
 */
 
135
void StringOutputStream::flush()
 
136
{
 
137
    //nothing to do
 
138
}
 
139
 
 
140
/**
 
141
 * Writes the specified byte to this output stream.
 
142
 */
 
143
int StringOutputStream::put(XMLCh ch)
 
144
{
 
145
    buffer.push_back(ch);
 
146
    return 1;
 
147
}
 
148
 
 
149
 
 
150
 
 
151
 
 
152
}  //namespace io
 
153
}  //namespace dom
 
154
}  //namespace w3c
 
155
}  //namespace org
 
156
 
 
157
//#########################################################################
 
158
//# E N D    O F    F I L E
 
159
//#########################################################################