diff options
| author | Kris De Gussem <kris.degussem@gmail.com> | 2013-03-03 09:18:37 +0000 |
|---|---|---|
| committer | Kris <Kris.De.Gussem@hotmail.com> | 2013-03-03 09:18:37 +0000 |
| commit | 1279e676eccb0b3786d21fd390e4965f78a003c1 (patch) | |
| tree | 7caebee8350e7ddced1dfdccb1b34d38a7d47b8c /src | |
| parent | Fix autotools deprecation warnings (diff) | |
| download | inkscape-1279e676eccb0b3786d21fd390e4965f78a003c1.tar.gz inkscape-1279e676eccb0b3786d21fd390e4965f78a003c1.zip | |
Preparation to merge /dom/io and /io code (bug #1120585 )
(bzr r12168)
Diffstat (limited to 'src')
| -rw-r--r-- | src/dom/io/domstream.cpp | 218 | ||||
| -rw-r--r-- | src/dom/io/domstream.h | 233 | ||||
| -rw-r--r-- | src/dom/io/uristream.cpp | 6 | ||||
| -rw-r--r-- | src/dom/io/uristream.h | 2 | ||||
| -rw-r--r-- | src/io/base64stream.cpp | 5 | ||||
| -rw-r--r-- | src/io/base64stream.h | 2 | ||||
| -rw-r--r-- | src/io/gzipstream.cpp | 6 | ||||
| -rw-r--r-- | src/io/gzipstream.h | 2 | ||||
| -rw-r--r-- | src/io/inkscapestream.cpp | 42 | ||||
| -rw-r--r-- | src/io/inkscapestream.h | 8 | ||||
| -rw-r--r-- | src/io/stringstream.cpp | 3 | ||||
| -rw-r--r-- | src/io/stringstream.h | 2 | ||||
| -rw-r--r-- | src/io/uristream.cpp | 8 | ||||
| -rw-r--r-- | src/io/uristream.h | 2 | ||||
| -rw-r--r-- | src/io/xsltstream.cpp | 3 | ||||
| -rw-r--r-- | src/io/xsltstream.h | 2 |
16 files changed, 231 insertions, 313 deletions
diff --git a/src/dom/io/domstream.cpp b/src/dom/io/domstream.cpp index 21d09662a..b9ff7e9d2 100644 --- a/src/dom/io/domstream.cpp +++ b/src/dom/io/domstream.cpp @@ -424,12 +424,11 @@ static int dprintf(Writer &outs, const DOMString &fmt, va_list ap) //# B A S I C I N P U T S T R E A M //######################################################################### - /** * - */ -BasicInputStream::BasicInputStream(const InputStream &sourceStream) - : source((InputStream &)sourceStream) + */ +BasicInputStream::BasicInputStream(InputStream &sourceStream) + : source(sourceStream) { closed = false; } @@ -438,7 +437,7 @@ BasicInputStream::BasicInputStream(const InputStream &sourceStream) * Returns the number of bytes that can be read (or skipped over) from * this input stream without blocking by the next caller of a method for * this input stream. - */ + */ int BasicInputStream::available() { if (closed) @@ -446,11 +445,11 @@ int BasicInputStream::available() return source.available(); } - + /** * Closes this input stream and releases any system resources * associated with the stream. - */ + */ void BasicInputStream::close() { if (closed) @@ -458,10 +457,10 @@ void BasicInputStream::close() source.close(); closed = true; } - + /** * Reads the next byte of data from the input stream. -1 if EOF - */ + */ int BasicInputStream::get() { if (closed) @@ -477,9 +476,9 @@ int BasicInputStream::get() /** * - */ -BasicOutputStream::BasicOutputStream(const OutputStream &destinationStream) - : destination((OutputStream &)destinationStream) + */ +BasicOutputStream::BasicOutputStream(OutputStream &destinationStream) + : destination(destinationStream) { closed = false; } @@ -487,7 +486,7 @@ BasicOutputStream::BasicOutputStream(const OutputStream &destinationStream) /** * Closes this output stream and releases any system resources * associated with this stream. - */ + */ void BasicOutputStream::close() { if (closed) @@ -495,40 +494,33 @@ void BasicOutputStream::close() destination.close(); closed = true; } - + /** * Flushes this output stream and forces any buffered output * bytes to be written out. - */ + */ void BasicOutputStream::flush() { if (closed) return; destination.flush(); } - + /** * Writes the specified byte to this output stream. - */ + */ int BasicOutputStream::put(gunichar ch) { if (closed) return -1; - if (destination.put(ch) < 0) - return -1; - return 1; + destination.put(ch); + return 1; } - //######################################################################### //# B A S I C R E A D E R //######################################################################### - - -/** - * - */ BasicReader::BasicReader(Reader &sourceReader) { source = &sourceReader; @@ -538,7 +530,7 @@ BasicReader::BasicReader(Reader &sourceReader) * Returns the number of bytes that can be read (or skipped over) from * this reader without blocking by the next caller of a method for * this reader. - */ + */ int BasicReader::available() { if (source) @@ -547,69 +539,65 @@ int BasicReader::available() return 0; } - + /** * Closes this reader and releases any system resources * associated with the reader. - */ + */ void BasicReader::close() { if (source) source->close(); } - + /** * Reads the next byte of data from the reader. - */ -int BasicReader::get() + */ +gunichar BasicReader::get() { if (source) return source->get(); else - return -1; + return (gunichar)-1; } - - - - - + /** * Reads a line of data from the reader. - */ -DOMString BasicReader::readLine() + */ +Glib::ustring BasicReader::readLine() { - DOMString str; + Glib::ustring str; while (available() > 0) { - XMLCh ch = get(); + gunichar ch = get(); if (ch == '\n') break; str.push_back(ch); } return str; } - + /** * Reads a line of data from the reader. - */ -DOMString BasicReader::readWord() + */ +Glib::ustring BasicReader::readWord() { - DOMString str; + Glib::ustring str; while (available() > 0) { - XMLCh ch = get(); - if (uni_is_space(ch)) + gunichar ch = get(); + if (!g_unichar_isprint(ch)) break; str.push_back(ch); } return str; } + - -static bool getLong(DOMString &str, long *val) +static bool getLong(Glib::ustring &str, long *val) { - const char *begin = str.c_str(); + const char *begin = str.raw().c_str(); char *end; long ival = strtol(begin, &end, 10); if (str == end) @@ -618,25 +606,23 @@ static bool getLong(DOMString &str, long *val) return true; } -static bool getULong(const DOMString &str, unsigned long *val) +static bool getULong(Glib::ustring &str, unsigned long *val) { - DOMString tmp = str; - char *begin = (char *)tmp.c_str(); + const char *begin = str.raw().c_str(); char *end; unsigned long ival = strtoul(begin, &end, 10); - if (begin == end) + if (str == end) return false; *val = ival; return true; } -static bool getDouble(const DOMString &str, double *val) +static bool getDouble(Glib::ustring &str, double *val) { - DOMString tmp = str; - const char *begin = tmp.c_str(); + const char *begin = str.raw().c_str(); char *end; double ival = strtod(begin, &end); - if (begin == end) + if (str == end) return false; *val = ival; return true; @@ -644,13 +630,9 @@ static bool getDouble(const DOMString &str, double *val) - -/** - * - */ -Reader &BasicReader::readBool (bool& val ) +const Reader &BasicReader::readBool (bool& val ) { - DOMString buf = readWord(); + Glib::ustring buf = readWord(); if (buf == "true") val = true; else @@ -658,96 +640,72 @@ Reader &BasicReader::readBool (bool& val ) return *this; } -/** - * - */ -Reader &BasicReader::readShort (short& val ) +const Reader &BasicReader::readShort (short& val ) { - DOMString buf = readWord(); + Glib::ustring buf = readWord(); long ival; if (getLong(buf, &ival)) val = (short) ival; return *this; } -/** - * - */ -Reader &BasicReader::readUnsignedShort (unsigned short& val ) +const Reader &BasicReader::readUnsignedShort (unsigned short& val ) { - DOMString buf = readWord(); + Glib::ustring buf = readWord(); unsigned long ival; if (getULong(buf, &ival)) val = (unsigned short) ival; return *this; } -/** - * - */ -Reader &BasicReader::readInt (int& val ) +const Reader &BasicReader::readInt (int& val ) { - DOMString buf = readWord(); + Glib::ustring buf = readWord(); long ival; if (getLong(buf, &ival)) val = (int) ival; return *this; } -/** - * - */ -Reader &BasicReader::readUnsignedInt (unsigned int& val ) +const Reader &BasicReader::readUnsignedInt (unsigned int& val ) { - DOMString buf = readWord(); + Glib::ustring buf = readWord(); unsigned long ival; if (getULong(buf, &ival)) val = (unsigned int) ival; return *this; } -/** - * - */ -Reader &BasicReader::readLong (long& val ) +const Reader &BasicReader::readLong (long& val ) { - DOMString buf = readWord(); + Glib::ustring buf = readWord(); long ival; if (getLong(buf, &ival)) val = ival; return *this; } -/** - * - */ -Reader &BasicReader::readUnsignedLong (unsigned long& val ) +const Reader &BasicReader::readUnsignedLong (unsigned long& val ) { - DOMString buf = readWord(); + Glib::ustring buf = readWord(); unsigned long ival; if (getULong(buf, &ival)) val = ival; return *this; } -/** - * - */ -Reader &BasicReader::readFloat (float& val ) +const Reader &BasicReader::readFloat (float& val ) { - DOMString buf = readWord(); + Glib::ustring buf = readWord(); double ival; if (getDouble(buf, &ival)) val = (float)ival; return *this; } -/** - * - */ -Reader &BasicReader::readDouble (double& val ) +const Reader &BasicReader::readDouble (double& val ) { - DOMString buf = readWord(); + Glib::ustring buf = readWord(); double ival; if (getDouble(buf, &ival)) val = ival; @@ -761,12 +719,12 @@ Reader &BasicReader::readDouble (double& val ) //######################################################################### -InputStreamReader::InputStreamReader(const InputStream &inputStreamSource) - : inputStream((InputStream &)inputStreamSource) +InputStreamReader::InputStreamReader(InputStream &inputStreamSource) + : inputStream(inputStreamSource) { } - + /** * Close the underlying OutputStream @@ -775,7 +733,7 @@ void InputStreamReader::close() { inputStream.close(); } - + /** * Flush the underlying OutputStream */ @@ -783,15 +741,15 @@ int InputStreamReader::available() { return inputStream.available(); } - + /** * Overloaded to receive its bytes from an InputStream * rather than a Reader */ -int InputStreamReader::get() +gunichar InputStreamReader::get() { //Do we need conversions here? - int ch = (XMLCh)inputStream.get(); + gunichar ch = (gunichar)inputStream.get(); return ch; } @@ -818,7 +776,7 @@ StdReader::~StdReader() delete inputStream; } - + /** * Close the underlying OutputStream @@ -827,7 +785,7 @@ void StdReader::close() { inputStream->close(); } - + /** * Flush the underlying OutputStream */ @@ -835,22 +793,21 @@ int StdReader::available() { return inputStream->available(); } - + /** * Overloaded to receive its bytes from an InputStream * rather than a Reader */ -int StdReader::get() +gunichar StdReader::get() { //Do we need conversions here? - XMLCh ch = (XMLCh)inputStream->get(); + gunichar ch = (gunichar)inputStream->get(); return ch; } - //######################################################################### //# B A S I C W R I T E R //######################################################################### @@ -1145,13 +1102,6 @@ int StdWriter::put(gunichar ch) - - - - - - - //############################################### //# O P E R A T O R S //############################################### @@ -1165,31 +1115,31 @@ int StdWriter::put(gunichar ch) -Reader& operator>> (Reader &reader, bool& val ) +const Reader& operator>> (Reader &reader, bool& val ) { return reader.readBool(val); } -Reader& operator>> (Reader &reader, short &val) +const Reader& operator>> (Reader &reader, short &val) { return reader.readShort(val); } -Reader& operator>> (Reader &reader, unsigned short &val) +const Reader& operator>> (Reader &reader, unsigned short &val) { return reader.readUnsignedShort(val); } -Reader& operator>> (Reader &reader, int &val) +const Reader& operator>> (Reader &reader, int &val) { return reader.readInt(val); } -Reader& operator>> (Reader &reader, unsigned int &val) +const Reader& operator>> (Reader &reader, unsigned int &val) { return reader.readUnsignedInt(val); } -Reader& operator>> (Reader &reader, long &val) +const Reader& operator>> (Reader &reader, long &val) { return reader.readLong(val); } -Reader& operator>> (Reader &reader, unsigned long &val) +const Reader& operator>> (Reader &reader, unsigned long &val) { return reader.readUnsignedLong(val); } -Reader& operator>> (Reader &reader, float &val) +const Reader& operator>> (Reader &reader, float &val) { return reader.readFloat(val); } -Reader& operator>> (Reader &reader, double &val) +const Reader& operator>> (Reader &reader, double &val) { return reader.readDouble(val); } diff --git a/src/dom/io/domstream.h b/src/dom/io/domstream.h index 925e52bfe..a021676fa 100644 --- a/src/dom/io/domstream.h +++ b/src/dom/io/domstream.h @@ -44,23 +44,21 @@ namespace dom namespace io { - - -class StreamException +class StreamException : public std::exception { public: - StreamException(const DOMString &theReason) throw() - : reason(theReason) - {} + StreamException(const char *theReason) throw() + { reason = theReason; } + StreamException(Glib::ustring &theReason) throw() + { reason = theReason; } virtual ~StreamException() throw() { } - char const *what() + char const *what() const throw() { return reason.c_str(); } - + private: - - DOMString reason; + Glib::ustring reason; }; @@ -95,14 +93,14 @@ public: * to be read */ virtual int available() = 0; - + /** * Do whatever it takes to 'close' this input stream * The most likely implementation of this method will be * for endpoints that use a resource for their data. */ virtual void close() = 0; - + /** * Read one byte from this input stream. This is a blocking * call. If no data is currently available, this call will @@ -113,7 +111,7 @@ public: * This call returns -1 on end-of-file. */ virtual int get() = 0; - + }; // class InputStream @@ -129,22 +127,22 @@ class BasicInputStream : public InputStream public: - BasicInputStream(const InputStream &sourceStream); - + BasicInputStream(InputStream &sourceStream); + virtual ~BasicInputStream() {} - + virtual int available(); - + virtual void close(); - + virtual int get(); - + protected: bool closed; InputStream &source; - + private: @@ -161,10 +159,10 @@ public: int available() { return 0; } - + void close() { /* do nothing */ } - + int get() { return getchar(); } @@ -174,7 +172,6 @@ public: - //######################################################################### //# O U T P U T S T R E A M //######################################################################### @@ -207,14 +204,14 @@ public: * 3. close the destination stream */ virtual void close() = 0; - + /** * This call should push any pending data it might have to * the destination stream. It should NOT call flush() on * the destination stream. */ virtual void flush() = 0; - + /** * Send one byte to the destination stream. */ @@ -233,14 +230,14 @@ class BasicOutputStream : public OutputStream public: - BasicOutputStream(const OutputStream &destinationStream); - + BasicOutputStream(OutputStream &destinationStream); + virtual ~BasicOutputStream() {} virtual void close(); - + virtual void flush(); - + virtual int put(gunichar ch); protected: @@ -263,12 +260,12 @@ public: void close() { } - + void flush() { } - + int put(gunichar ch) - { putchar(ch); return 1; } + { return putchar(ch); } }; @@ -279,7 +276,6 @@ public: //# R E A D E R //######################################################################### - /** * This interface and its descendants are for unicode character-oriented input * @@ -301,33 +297,42 @@ public: virtual int available() = 0; - + virtual void close() = 0; - - virtual int get() = 0; - - virtual DOMString readLine() = 0; - - virtual DOMString readWord() = 0; - + + virtual gunichar get() = 0; + + virtual Glib::ustring readLine() = 0; + + virtual Glib::ustring readWord() = 0; + /* Input formatting */ - virtual Reader& readBool (bool& val ) = 0; - - virtual Reader& readShort (short &val) = 0; - - virtual Reader& readUnsignedShort (unsigned short &val) = 0; - - virtual Reader& readInt (int &val) = 0; - - virtual Reader& readUnsignedInt (unsigned int &val) = 0; - - virtual Reader& readLong (long &val) = 0; - - virtual Reader& readUnsignedLong (unsigned long &val) = 0; - - virtual Reader& readFloat (float &val) = 0; - - virtual Reader& readDouble (double &val) = 0; + virtual const Reader& readBool (bool& val ) = 0; + virtual const Reader& operator>> (bool& val ) = 0; + + virtual const Reader& readShort (short &val) = 0; + virtual const Reader& operator>> (short &val) = 0; + + virtual const Reader& readUnsignedShort (unsigned short &val) = 0; + virtual const Reader& operator>> (unsigned short &val) = 0; + + virtual const Reader& readInt (int &val) = 0; + virtual const Reader& operator>> (int &val) = 0; + + virtual const Reader& readUnsignedInt (unsigned int &val) = 0; + virtual const Reader& operator>> (unsigned int &val) = 0; + + virtual const Reader& readLong (long &val) = 0; + virtual const Reader& operator>> (long &val) = 0; + + virtual const Reader& readUnsignedLong (unsigned long &val) = 0; + virtual const Reader& operator>> (unsigned long &val) = 0; + + virtual const Reader& readFloat (float &val) = 0; + virtual const Reader& operator>> (float &val) = 0; + + virtual const Reader& readDouble (double &val) = 0; + virtual const Reader& operator>> (double &val) = 0; }; // interface Reader @@ -343,37 +348,56 @@ class BasicReader : public Reader public: BasicReader(Reader &sourceStream); - + virtual ~BasicReader() {} virtual int available(); - + virtual void close(); - - virtual int get(); - - virtual DOMString readLine(); - - virtual DOMString readWord(); - + + virtual gunichar get(); + + virtual Glib::ustring readLine(); + + virtual Glib::ustring readWord(); + /* Input formatting */ - virtual Reader& readBool (bool& val ); - - virtual Reader& readShort (short &val) ; - - virtual Reader& readUnsignedShort (unsigned short &val) ; - - virtual Reader& readInt (int &val) ; - - virtual Reader& readUnsignedInt (unsigned int &val) ; - - virtual Reader& readLong (long &val) ; - - virtual Reader& readUnsignedLong (unsigned long &val) ; - - virtual Reader& readFloat (float &val) ; - - virtual Reader& readDouble (double &val) ; + virtual const Reader& readBool (bool& val ); + virtual const Reader& operator>> (bool& val ) + { return readBool(val); } + + virtual const Reader& readShort (short &val); + virtual const Reader& operator>> (short &val) + { return readShort(val); } + + virtual const Reader& readUnsignedShort (unsigned short &val); + virtual const Reader& operator>> (unsigned short &val) + { return readUnsignedShort(val); } + + virtual const Reader& readInt (int &val); + virtual const Reader& operator>> (int &val) + { return readInt(val); } + + virtual const Reader& readUnsignedInt (unsigned int &val); + virtual const Reader& operator>> (unsigned int &val) + { return readUnsignedInt(val); } + + virtual const Reader& readLong (long &val); + virtual const Reader& operator>> (long &val) + { return readLong(val); } + + virtual const Reader& readUnsignedLong (unsigned long &val); + virtual const Reader& operator>> (unsigned long &val) + { return readUnsignedLong(val); } + + virtual const Reader& readFloat (float &val); + virtual const Reader& operator>> (float &val) + { return readFloat(val); } + + virtual const Reader& readDouble (double &val); + virtual const Reader& operator>> (double &val) + { return readDouble(val); } + protected: @@ -388,27 +412,6 @@ private: -Reader& operator>> (Reader &reader, bool& val ); - -Reader& operator>> (Reader &reader, short &val); - -Reader& operator>> (Reader &reader, unsigned short &val); - -Reader& operator>> (Reader &reader, int &val); - -Reader& operator>> (Reader &reader, unsigned int &val); - -Reader& operator>> (Reader &reader, long &val); - -Reader& operator>> (Reader &reader, unsigned long &val); - -Reader& operator>> (Reader &reader, float &val); - -Reader& operator>> (Reader &reader, double &val); - - - - /** * Class for placing a Reader on an open InputStream * @@ -417,14 +420,14 @@ class InputStreamReader : public BasicReader { public: - InputStreamReader(const InputStream &inputStreamSource); - + InputStreamReader(InputStream &inputStreamSource); + /*Overload these 3 for your implementation*/ virtual int available(); - + virtual void close(); - - virtual int get(); + + virtual gunichar get(); private: @@ -445,13 +448,13 @@ public: StdReader(); virtual ~StdReader(); - + /*Overload these 3 for your implementation*/ virtual int available(); - + virtual void close(); - - virtual int get(); + + virtual gunichar get(); private: @@ -463,8 +466,6 @@ private: - - //######################################################################### //# W R I T E R //######################################################################### diff --git a/src/dom/io/uristream.cpp b/src/dom/io/uristream.cpp index 68a14a166..f6172d9e0 100644 --- a/src/dom/io/uristream.cpp +++ b/src/dom/io/uristream.cpp @@ -235,10 +235,10 @@ void UriReader::close() throw(StreamException) /** * */ -int UriReader::get() throw(StreamException) +gunichar UriReader::get() throw(StreamException) { - int ch = (int)inputStream->get(); - return ch; + //int ch = (int)inputStream->get(); + return inputStream->get();//ch; } diff --git a/src/dom/io/uristream.h b/src/dom/io/uristream.h index 2a659d030..51227acc9 100644 --- a/src/dom/io/uristream.h +++ b/src/dom/io/uristream.h @@ -111,7 +111,7 @@ public: virtual void close() throw(StreamException); - virtual int get() throw(StreamException); + virtual gunichar get() throw(StreamException); private: diff --git a/src/io/base64stream.cpp b/src/io/base64stream.cpp index 42a6ba1e4..28c819347 100644 --- a/src/io/base64stream.cpp +++ b/src/io/base64stream.cpp @@ -290,12 +290,12 @@ void Base64OutputStream::putCh(int ch) /** * Writes the specified byte to this output stream. */ -void Base64OutputStream::put(gunichar ch) +int Base64OutputStream::put(gunichar ch) { if (closed) { //probably throw an exception here - return; + return -1; } outBuf <<= 8; @@ -322,6 +322,7 @@ void Base64OutputStream::put(gunichar ch) bitCount = 0; outBuf = 0L; } + return 1; } diff --git a/src/io/base64stream.h b/src/io/base64stream.h index 836939130..4bc99acac 100644 --- a/src/io/base64stream.h +++ b/src/io/base64stream.h @@ -88,7 +88,7 @@ public: virtual void flush(); - virtual void put(gunichar ch); + virtual int put(gunichar ch); /** * Sets the maximum line length for base64 output. If diff --git a/src/io/gzipstream.cpp b/src/io/gzipstream.cpp index 071179b48..8db7155db 100644 --- a/src/io/gzipstream.cpp +++ b/src/io/gzipstream.cpp @@ -433,19 +433,19 @@ void GzipOutputStream::flush() /** * Writes the specified byte to this output stream. */ -void GzipOutputStream::put(gunichar ch) +int GzipOutputStream::put(gunichar ch) { if (closed) { //probably throw an exception here - return; + return -1; } //Add char to buffer inputBuf.push_back(ch); totalIn++; - + return 1; } diff --git a/src/io/gzipstream.h b/src/io/gzipstream.h index 5af57b4c5..390ec1225 100644 --- a/src/io/gzipstream.h +++ b/src/io/gzipstream.h @@ -98,7 +98,7 @@ public: virtual void flush(); - virtual void put(gunichar ch); + virtual int put(gunichar ch); private: diff --git a/src/io/inkscapestream.cpp b/src/io/inkscapestream.cpp index 3270127d6..4c7fa4d49 100644 --- a/src/io/inkscapestream.cpp +++ b/src/io/inkscapestream.cpp @@ -125,11 +125,12 @@ void BasicOutputStream::flush() /** * Writes the specified byte to this output stream. */ -void BasicOutputStream::put(gunichar ch) +int BasicOutputStream::put(gunichar ch) { if (closed) - return; + return -1; destination.put(ch); + return 1; } @@ -137,8 +138,6 @@ void BasicOutputStream::put(gunichar ch) //######################################################################### //# B A S I C R E A D E R //######################################################################### - - /** * */ @@ -183,10 +182,6 @@ gunichar BasicReader::get() } - - - - /** * Reads a line of data from the reader. */ @@ -255,13 +250,6 @@ static bool getDouble(Glib::ustring &str, double *val) - - - - -/** - * - */ const Reader &BasicReader::readBool (bool& val ) { Glib::ustring buf = readWord(); @@ -272,9 +260,6 @@ const Reader &BasicReader::readBool (bool& val ) return *this; } -/** - * - */ const Reader &BasicReader::readShort (short& val ) { Glib::ustring buf = readWord(); @@ -284,9 +269,6 @@ const Reader &BasicReader::readShort (short& val ) return *this; } -/** - * - */ const Reader &BasicReader::readUnsignedShort (unsigned short& val ) { Glib::ustring buf = readWord(); @@ -296,9 +278,6 @@ const Reader &BasicReader::readUnsignedShort (unsigned short& val ) return *this; } -/** - * - */ const Reader &BasicReader::readInt (int& val ) { Glib::ustring buf = readWord(); @@ -308,9 +287,6 @@ const Reader &BasicReader::readInt (int& val ) return *this; } -/** - * - */ const Reader &BasicReader::readUnsignedInt (unsigned int& val ) { Glib::ustring buf = readWord(); @@ -320,9 +296,6 @@ const Reader &BasicReader::readUnsignedInt (unsigned int& val ) return *this; } -/** - * - */ const Reader &BasicReader::readLong (long& val ) { Glib::ustring buf = readWord(); @@ -332,9 +305,6 @@ const Reader &BasicReader::readLong (long& val ) return *this; } -/** - * - */ const Reader &BasicReader::readUnsignedLong (unsigned long& val ) { Glib::ustring buf = readWord(); @@ -344,9 +314,6 @@ const Reader &BasicReader::readUnsignedLong (unsigned long& val ) return *this; } -/** - * - */ const Reader &BasicReader::readFloat (float& val ) { Glib::ustring buf = readWord(); @@ -356,9 +323,6 @@ const Reader &BasicReader::readFloat (float& val ) return *this; } -/** - * - */ const Reader &BasicReader::readDouble (double& val ) { Glib::ustring buf = readWord(); diff --git a/src/io/inkscapestream.h b/src/io/inkscapestream.h index a9854ae6d..d19dbbe95 100644 --- a/src/io/inkscapestream.h +++ b/src/io/inkscapestream.h @@ -189,7 +189,7 @@ public: /** * Send one byte to the destination stream. */ - virtual void put(gunichar ch) = 0; + virtual int put(gunichar ch) = 0; }; // class OutputStream @@ -212,7 +212,7 @@ public: virtual void flush(); - virtual void put(gunichar ch); + virtual int put(gunichar ch); protected: @@ -238,8 +238,8 @@ public: void flush() { } - void put(gunichar ch) - { putchar(ch); } + int put(gunichar ch) + {return putchar(ch); } }; diff --git a/src/io/stringstream.cpp b/src/io/stringstream.cpp index f204a99d5..5a76e24a3 100644 --- a/src/io/stringstream.cpp +++ b/src/io/stringstream.cpp @@ -112,9 +112,10 @@ void StringOutputStream::flush() /** * Writes the specified byte to this output stream. */ -void StringOutputStream::put(gunichar ch) +int StringOutputStream::put(gunichar ch) { buffer.push_back(ch); + return 1; } diff --git a/src/io/stringstream.h b/src/io/stringstream.h index a78935599..939a87455 100644 --- a/src/io/stringstream.h +++ b/src/io/stringstream.h @@ -67,7 +67,7 @@ public: virtual void flush(); - virtual void put(gunichar ch); + virtual int put(gunichar ch); virtual Glib::ustring &getString() { return buffer; } diff --git a/src/io/uristream.cpp b/src/io/uristream.cpp index 8d7fd9b38..37c13ada0 100644 --- a/src/io/uristream.cpp +++ b/src/io/uristream.cpp @@ -402,17 +402,17 @@ void UriOutputStream::flush() throw(StreamException) /** * Writes the specified byte to this output stream. */ -void UriOutputStream::put(gunichar ch) throw(StreamException) +int UriOutputStream::put(gunichar ch) throw(StreamException) { if (closed) - return; + return -1; unsigned char uch; switch (scheme) { case SCHEME_FILE: if (!outf) - return; + return -1; uch = (unsigned char)(ch & 0xff); if (fputc(uch, outf) == EOF) { Glib::ustring err = "ERROR writing to file "; @@ -425,7 +425,7 @@ void UriOutputStream::put(gunichar ch) throw(StreamException) break; }//switch - + return 1; } diff --git a/src/io/uristream.h b/src/io/uristream.h index e519335e8..3080519de 100644 --- a/src/io/uristream.h +++ b/src/io/uristream.h @@ -115,7 +115,7 @@ public: virtual void flush() throw(StreamException); - virtual void put(gunichar ch) throw(StreamException); + virtual int put(gunichar ch) throw(StreamException); private: diff --git a/src/io/xsltstream.cpp b/src/io/xsltstream.cpp index 1c260c0b3..7a6632233 100644 --- a/src/io/xsltstream.cpp +++ b/src/io/xsltstream.cpp @@ -230,9 +230,10 @@ void XsltOutputStream::flush() throw (StreamException) /** * Writes the specified byte to this output stream. */ -void XsltOutputStream::put(gunichar ch) throw (StreamException) +int XsltOutputStream::put(gunichar ch) throw (StreamException) { outbuf.push_back(ch); + return 1; } diff --git a/src/io/xsltstream.h b/src/io/xsltstream.h index 9b8e19215..31ee89e10 100644 --- a/src/io/xsltstream.h +++ b/src/io/xsltstream.h @@ -120,7 +120,7 @@ public: virtual void flush() throw (StreamException); - virtual void put(gunichar ch) throw (StreamException); + virtual int put(gunichar ch) throw (StreamException); private: |
