Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

StrCharStream.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    StrCharStream.h
00006  *
00007  *  $Id: StrCharStream.h,v 1.1.1.1 2003/02/21 18:36:32 chad 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   /// Initializing Constructor.
00038   ACEXML_StrCharStream (const ACEXML_Char *str);
00039 
00040   /// Destructor
00041   virtual ~ACEXML_StrCharStream (void);
00042 
00043   /// Initializing and reset the StrCharStream with @a str.
00044   int open (const ACEXML_Char *str);
00045 
00046   /**
00047    * Returns the available ACEXML_Char in the buffer.  -1
00048    * if the object is not initialized properly.
00049    */
00050   virtual int available (void);
00051 
00052   /**
00053    * Close this stream and release all resources used by it.
00054    */
00055   virtual int close (void);
00056 
00057   /**
00058    *  Determine the encoding of the file.
00059    */
00060   virtual int determine_encoding (void);
00061 
00062   /**
00063    * Read the next ACEXML_Char.  Return -1 if we are not able to
00064    * return an ACEXML_Char, 0 if EOS is reached, or 1 if succeed.
00065    */
00066   virtual int get (ACEXML_Char& ch);
00067 
00068   /**
00069    * Read the next batch of ACEXML_Char strings
00070    */
00071   virtual int read (ACEXML_Char *str,
00072                     size_t len);
00073 
00074   /**
00075    * Peek the next ACEXML_Char in the CharStream.  Return the
00076    * character if succeess, -1 if EOS is reached.
00077    */
00078   virtual int peek (void);
00079 
00080   /*
00081    * Get the character encoding for a byte stream or URI.
00082    */
00083   virtual const ACEXML_Char *getEncoding (void);
00084 
00085   /**
00086    *  Resets the pointer to the beginning of the stream.
00087    */
00088   virtual void rewind (void);
00089 
00090 private:
00091   ACEXML_Char *start_;
00092   ACEXML_Char *ptr_;
00093   ACEXML_Char *end_;
00094   ACEXML_Char* encoding_;
00095 
00096 };
00097 
00098 #include "ace/post.h"
00099 
00100 #endif /* _ACEXML_STRCHARSTREAM_H_ */

Generated on Mon Jun 16 13:23:26 2003 for ACEXML by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002