StrCharStream.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    StrCharStream.h
00006  *
00007  *  StrCharStream.h,v 1.7 2003/07/19 19:04:10 dhinton Exp
00008  *
00009  *  @author Nanbor Wang <nanbor@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef _ACEXML_STRCHARSTREAM_H_
00014 #define _ACEXML_STRCHARSTREAM_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 
00023 #include "ACEXML/common/CharStream.h"
00024 
00025 /**
00026  * @class ACEXML_StrCharStream StrCharStream.h "common/StrCharStream.h"
00027  *
00028  * An implementation of ACEXML_CharStream for reading
00029  * input from a null-terminated ACEXML_Char string.
00030  */
00031 class ACEXML_Export ACEXML_StrCharStream : public ACEXML_CharStream
00032 {
00033 public:
00034   /// Default constructor.
00035   ACEXML_StrCharStream (void);
00036 
00037   /// Destructor
00038   virtual ~ACEXML_StrCharStream (void);
00039 
00040   /// Initializing StrCharStream with @a str and @a name
00041   int open (const ACEXML_Char *str, const ACEXML_Char* name);
00042 
00043   /**
00044    * Returns the available ACEXML_Char in the buffer.  -1
00045    * if the object is not initialized properly.
00046    */
00047   virtual int available (void);
00048 
00049   /**
00050    * Close this stream and release all resources used by it.
00051    */
00052   virtual int close (void);
00053 
00054   /**
00055    *  Determine the encoding of the file.
00056    */
00057   virtual int determine_encoding (void);
00058 
00059   /**
00060    * Read the next ACEXML_Char.  Return -1 if we are not able to
00061    * return an ACEXML_Char, 0 if EOS is reached, or 1 if succeed.
00062    */
00063   virtual int get (ACEXML_Char& ch);
00064 
00065   /**
00066    * Read the next batch of ACEXML_Char strings
00067    */
00068   virtual int read (ACEXML_Char *str, size_t len);
00069 
00070   /**
00071    * Peek the next ACEXML_Char in the CharStream.  Return the
00072    * character if succeess, -1 if EOS is reached.
00073    */
00074   virtual int peek (void);
00075 
00076   /*
00077    * Get the character encoding for a byte stream or URI.
00078    */
00079   virtual const ACEXML_Char *getEncoding (void);
00080 
00081   /*
00082    * Get the systemId for the underlying CharStream
00083    */
00084   virtual const ACEXML_Char* getSystemId (void);
00085 
00086   /**
00087    *  Resets the pointer to the beginning of the stream.
00088    */
00089   virtual void rewind (void);
00090 
00091 private:
00092   ACEXML_Char *start_;
00093   ACEXML_Char *ptr_;
00094   ACEXML_Char *end_;
00095   ACEXML_Char* encoding_;
00096   ACEXML_Char* name_;
00097 
00098 };
00099 
00100 #include /**/ "ace/post.h"
00101 
00102 #endif /* _ACEXML_STRCHARSTREAM_H_ */

Generated on Thu Nov 9 11:45:39 2006 for ACEXML by doxygen 1.3.6