3 //=============================================================================
7 * @author Nanbor Wang <nanbor@cs.wustl.edu>
9 //=============================================================================
11 #ifndef _ACEXML_CHARSTREAM_H_
12 #define _ACEXML_CHARSTREAM_H_
14 #include /**/ "ace/pre.h"
15 #include "ACEXML/common/ACEXML_Export.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
20 #include "ACEXML/common/XML_Types.h"
23 * @class ACEXML_CharStream
25 * ACEXML_CharStream is an abstract class (interface) which defines the
26 * basic opertions a parser could use to retrieve XML charater sequence.
27 * The sequence can be read from a file or a character buffer.
29 class ACEXML_Export ACEXML_CharStream
33 * Virtual destructor, must have.
35 virtual ~ACEXML_CharStream () = 0;
38 * Returns the available ACEXML_Char in the buffer. -1
39 * if the object is not initialized properly.
41 virtual int available () = 0;
44 * Close this stream and release all resources used by it.
46 virtual int close () = 0;
49 * Read the next ACEXML_Char. Return -1 if we are not able to
50 * return an ACEXML_Char, 0 if EOS is reached, or 1 if succeed.
52 virtual int get (ACEXML_Char
& ch
) = 0;
55 * Read the next batch of ACEXML_Char strings
57 virtual int read (ACEXML_Char
*str
, size_t len
) = 0;
60 * Peek the next ACEXML_Char in the CharStream. Return the
61 * character if succeess, -1 if EOS is reached.
63 virtual int peek () = 0;
66 * Resets the pointer to the beginning of the stream.
68 virtual void rewind () = 0;
71 * Get the character encoding for a byte stream or URI.
73 virtual const ACEXML_Char
*getEncoding () = 0;
76 * Get the systemId for the underlying CharStream
78 virtual const ACEXML_Char
* getSystemId () = 0;
81 #include /**/ "ace/post.h"
84 #endif /* _ACEXML_CHARSTREAM_H_ */