domstream.h revision 819aa4f3956291e17dab9b2548dce90d4b195a03
#ifndef SEEN_DOMSTREAM_H
#define SEEN_DOMSTREAM_H
/**
* @file
* Phoebe DOM Implementation.
*
* This is a C++ approximation of the W3C DOM model, which follows
* fairly closely the specifications in the various .idl files, copies of
* which are provided for reference. Most important is this one:
*
*/
/*
* Authors:
* Bob Jamison
*
* Copyright (C) 2006-2007 Bob Jamison
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <cstdio>
{
{
{
{
{
{}
{ }
char const *what()
};
//#########################################################################
//# I N P U T S T R E A M
//#########################################################################
/**
* This interface is the base of all input stream classes. Users who wish
* to make an InputStream that is part of a chain should inherit from
* BasicInputStream. Inherit from this class to make a source endpoint,
* such as a URI or buffer.
*
*/
{
/**
* Constructor.
*/
InputStream() {}
/**
* Destructor
*/
virtual ~InputStream() {}
/**
* Return the number of bytes that are currently available
* to be read
*/
/**
* 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.
*/
/**
* Read one byte from this input stream. This is a blocking
* call. If no data is currently available, this call will
* not return until it exists. If the user does not want
* their code to block, then the usual solution is:
* if (available() > 0)
* myChar = get();
* This call returns -1 on end-of-file.
*/
}; // class InputStream
/**
* This is the class that most users should inherit, to provide
* their own streams.
*
*/
{
virtual ~BasicInputStream() {}
bool closed;
}; // class BasicInputStream
/**
* Convenience class for reading from standard input
*/
{
int available()
{ return 0; }
void close()
{ /* do nothing */ }
int get()
{ return getchar(); }
};
//#########################################################################
//# O U T P U T S T R E A M
//#########################################################################
/**
* This interface is the base of all input stream classes. Users who wish
* to make an OutputStream that is part of a chain should inherit from
* BasicOutputStream. Inherit from this class to make a destination endpoint,
* such as a URI or buffer.
*/
{
/**
* Constructor.
*/
OutputStream() {}
/**
* Destructor
*/
virtual ~OutputStream() {}
/**
* This call should
* 1. flush itself
* 2. close itself
* 3. close the destination stream
*/
/**
* This call should push any pending data it might have to
* the destination stream. It should NOT call flush() on
* the destination stream.
*/
/**
* Send one byte to the destination stream.
*/
}; // class OutputStream
/**
* This is the class that most users should inherit, to provide
* their own output streams.
*/
{
virtual ~BasicOutputStream() {}
bool closed;
}; // class BasicOutputStream
/**
* Convenience class for writing to standard output
*/
{
void close()
{ }
void flush()
{ }
};
//#########################################################################
//# R E A D E R
//#########################################################################
/**
* This interface and its descendants are for unicode character-oriented input
*
*/
{
/**
* Constructor.
*/
Reader() {}
/**
* Destructor
*/
/* Input formatting */
}; // interface Reader
/**
* This class and its descendants are for unicode character-oriented input
*
*/
{
virtual ~BasicReader() {}
/* Input formatting */
}; // class BasicReader
/**
* Class for placing a Reader on an open InputStream
*
*/
{
/*Overload these 3 for your implementation*/
};
/**
* Convenience class for reading formatted from standard input
*
*/
{
StdReader();
/*Overload these 3 for your implementation*/
};
//#########################################################################
//# W R I T E R
//#########################################################################
/**
* This interface and its descendants are for unicode character-oriented output
*
*/
{
/**
* Constructor.
*/
Writer() {}
/**
* Destructor
*/
/* Formatted output */
}; // interface Writer
/**
* This class and its descendants are for unicode character-oriented output
*
*/
{
virtual ~BasicWriter() {}
/*Overload these 3 for your implementation*/
/* Formatted output */
{
destination = NULL;
for(int k=0;k<2048;++k)
{
formatBuf[k]=0;
}
}
//Used for printf() or other things that might
//require formatting before sending down the stream
char formatBuf[2048];
}; // class BasicWriter
/**
* Class for placing a Writer on an open OutputStream
*
*/
{
/*Overload these 3 for your implementation*/
};
/**
* Convenience class for writing to standard output
*/
{
StdWriter();
};
//#########################################################################
//# U T I L I T Y
//#########################################################################
} //namespace io
} //namespace dom
} //namespace w3c
} //namespace org
#endif // SEEN_DOMSTREAM_H
//#########################################################################
//# E N D O F F I L E
//#########################################################################