inkscapestream.cpp revision 819aa4f3956291e17dab9b2548dce90d4b195a03
/*
* inherited from iostreams, and includes any extra
* functionality that we might need.
*
* Authors:
* Bob Jamison <rjamison@titan.com>
*
* Copyright (C) 2004 Inkscape.org
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <cstdlib>
#include "inkscapestream.h"
namespace Inkscape
{
namespace IO
{
//#########################################################################
//# U T I L I T Y
//#########################################################################
{
for (;;)
{
if (ch<0)
break;
}
}
//#########################################################################
//# B A S I C I N P U T S T R E A M
//#########################################################################
/**
*
*/
{
closed = false;
}
/**
* 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)
return 0;
}
/**
* Closes this input stream and releases any system resources
* associated with the stream.
*/
void BasicInputStream::close()
{
if (closed)
return;
closed = true;
}
/**
* Reads the next byte of data from the input stream. -1 if EOF
*/
int BasicInputStream::get()
{
if (closed)
return -1;
}
//#########################################################################
//# B A S I C O U T P U T S T R E A M
//#########################################################################
/**
*
*/
{
closed = false;
}
/**
* Closes this output stream and releases any system resources
* associated with this stream.
*/
void BasicOutputStream::close()
{
if (closed)
return;
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.
*/
{
if (closed)
return;
}
//#########################################################################
//# B A S I C R E A D E R
//#########################################################################
/**
*
*/
{
source = &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)
else
return 0;
}
/**
* Closes this reader and releases any system resources
* associated with the reader.
*/
void BasicReader::close()
{
if (source)
}
/**
* Reads the next byte of data from the reader.
*/
{
if (source)
else
return (gunichar)-1;
}
/**
* Reads a line of data from the reader.
*/
{
while (available() > 0)
{
if (ch == '\n')
break;
}
return str;
}
/**
* Reads a line of data from the reader.
*/
{
while (available() > 0)
{
if (!g_unichar_isprint(ch))
break;
}
return str;
}
{
char *end;
return false;
return true;
}
{
char *end;
return false;
return true;
}
{
char *end;
return false;
return true;
}
/**
*
*/
{
if (buf == "true")
val = true;
else
val = false;
return *this;
}
/**
*
*/
{
long ival;
return *this;
}
/**
*
*/
{
unsigned long ival;
return *this;
}
/**
*
*/
{
long ival;
return *this;
}
/**
*
*/
{
unsigned long ival;
return *this;
}
/**
*
*/
{
long ival;
return *this;
}
/**
*
*/
{
unsigned long ival;
return *this;
}
/**
*
*/
{
double ival;
return *this;
}
/**
*
*/
{
double ival;
return *this;
}
//#########################################################################
//# I N P U T S T R E A M R E A D E R
//#########################################################################
{
}
/**
* Close the underlying OutputStream
*/
void InputStreamReader::close()
{
inputStream.close();
}
/**
* Flush the underlying OutputStream
*/
int InputStreamReader::available()
{
return inputStream.available();
}
/**
* Overloaded to receive its bytes from an InputStream
* rather than a Reader
*/
{
//Do we need conversions here?
return ch;
}
//#########################################################################
//# S T D R E A D E R
//#########################################################################
/**
*
*/
{
inputStream = new StdInputStream();
}
/**
*
*/
{
delete inputStream;
}
/**
* Close the underlying OutputStream
*/
{
inputStream->close();
}
/**
* Flush the underlying OutputStream
*/
{
return inputStream->available();
}
/**
* Overloaded to receive its bytes from an InputStream
* rather than a Reader
*/
{
//Do we need conversions here?
return ch;
}
//#########################################################################
//# B A S I C W R I T E R
//#########################################################################
/**
*
*/
{
}
/**
* Closes this writer and releases any system resources
* associated with this writer.
*/
void BasicWriter::close()
{
if (destination)
destination->close();
}
/**
* Flushes this output stream and forces any buffered output
* bytes to be written out.
*/
void BasicWriter::flush()
{
if (destination)
destination->flush();
}
/**
* Writes the specified byte to this output writer.
*/
{
if (destination)
}
/**
* Provide printf()-like formatting
*/
{
if (buf) {
}
return *this;
}
/**
* Writes the specified character to this output writer.
*/
{
return *this;
}
/**
* Writes the specified unicode string to this output writer.
*/
{
return *this;
}
/**
* Writes the specified standard string to this output writer.
*/
{
return *this;
}
/**
* Writes the specified character string to this output writer.
*/
{
if (str)
else
tmp = "null";
return *this;
}
/**
*
*/
{
if (val)
writeString("true");
else
writeString("false");
return *this;
}
/**
*
*/
{
if (buf) {
}
return *this;
}
/**
*
*/
{
if (buf) {
}
return *this;
}
/**
*
*/
{
if (buf) {
}
return *this;
}
/**
*
*/
{
if (buf) {
}
return *this;
}
/**
*
*/
{
if (buf) {
}
return *this;
}
/**
*
*/
{
if (buf) {
}
return *this;
}
/**
*
*/
{
#if 1
if (buf) {
}
#else
#endif
return *this;
}
/**
*
*/
{
#if 1
if (buf) {
}
#else
#endif
return *this;
}
//#########################################################################
//# O U T P U T S T R E A M W R I T E R
//#########################################################################
{
}
/**
* Close the underlying OutputStream
*/
void OutputStreamWriter::close()
{
flush();
}
/**
* Flush the underlying OutputStream
*/
void OutputStreamWriter::flush()
{
}
/**
* Overloaded to redirect the output chars from the next Writer
* in the chain to an OutputStream instead.
*/
{
}
//#########################################################################
//# S T D W R I T E R
//#########################################################################
/**
*
*/
{
outputStream = new StdOutputStream();
}
/**
*
*/
{
delete outputStream;
}
/**
* Close the underlying OutputStream
*/
{
flush();
outputStream->close();
}
/**
* Flush the underlying OutputStream
*/
{
outputStream->flush();
}
/**
* Overloaded to redirect the output chars from the next Writer
* in the chain to an OutputStream instead.
*/
{
}
} // namespace IO
} // namespace Inkscape
//#########################################################################
//# E N D O F F I L E
//#########################################################################