00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file CharStream.h 00006 * 00007 * CharStream.h,v 1.9 2004/01/09 00:50:35 kitty Exp 00008 * 00009 * @author Nanbor Wang <nanbor@cs.wustl.edu> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef _ACEXML_CHARSTREAM_H_ 00014 #define _ACEXML_CHARSTREAM_H_ 00015 00016 #include /**/ "ace/pre.h" 00017 #include "ACEXML/common/ACEXML_Export.h" 00018 00019 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00020 #pragma once 00021 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00022 #include "ACEXML/common/XML_Types.h" 00023 00024 /** 00025 * @class ACEXML_CharStream CharStream.h "ACEXML/common/CharStream.h" 00026 * 00027 * ACEXML_CharStream is an abstract class (interface) which defines the 00028 * basic opertions a parser could use to retrieve XML charater sequence. 00029 * The sequence can be read from a file or a character buffer. 00030 */ 00031 class ACEXML_Export ACEXML_CharStream 00032 { 00033 public: 00034 00035 /** 00036 * Virtual destructor, must have. 00037 */ 00038 virtual ~ACEXML_CharStream () = 0; 00039 00040 /** 00041 * Returns the available ACEXML_Char in the buffer. -1 00042 * if the object is not initialized properly. 00043 */ 00044 virtual int available (void) = 0; 00045 00046 /** 00047 * Close this stream and release all resources used by it. 00048 */ 00049 virtual int close (void) = 0; 00050 00051 /** 00052 * Read the next ACEXML_Char. Return -1 if we are not able to 00053 * return an ACEXML_Char, 0 if EOS is reached, or 1 if succeed. 00054 */ 00055 virtual int get (ACEXML_Char& ch) = 0; 00056 00057 /** 00058 * Read the next batch of ACEXML_Char strings 00059 */ 00060 virtual int read (ACEXML_Char *str, size_t len) = 0; 00061 00062 /** 00063 * Peek the next ACEXML_Char in the CharStream. Return the 00064 * character if succeess, -1 if EOS is reached. 00065 */ 00066 virtual int peek (void) = 0; 00067 00068 /** 00069 * Resets the pointer to the beginning of the stream. 00070 */ 00071 virtual void rewind (void) = 0; 00072 00073 /* 00074 * Get the character encoding for a byte stream or URI. 00075 */ 00076 virtual const ACEXML_Char *getEncoding (void) = 0; 00077 00078 /* 00079 * Get the systemId for the underlying CharStream 00080 */ 00081 virtual const ACEXML_Char* getSystemId (void) = 0; 00082 00083 }; 00084 00085 #include /**/ "ace/post.h" 00086 00087 00088 #endif /* _ACEXML_CHARSTREAM_H_ */