http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Readme
Release Info

Installation
Download
Build

FAQs
Samples
API Docs

DOM C++ Binding
Programming
Migration Guide

Feedback
Bug-Reporting
PDF Document

CVS Repository
Mail Archive

API Docs for SAX and DOM
 

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

BinMemInputStream.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 1999-2000,2004 The Apache Software Foundation.
00003  * 
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  * 
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 /*
00018  * $Log: BinMemInputStream.hpp,v $
00019  * Revision 1.5  2004/09/08 13:56:21  peiyongz
00020  * Apache License Version 2.0
00021  *
00022  * Revision 1.4  2004/01/29 11:48:46  cargilld
00023  * Code cleanup changes to get rid of various compiler diagnostic messages.
00024  *
00025  * Revision 1.3  2003/05/16 03:11:22  knoaman
00026  * Partial implementation of the configurable memory manager.
00027  *
00028  * Revision 1.2  2002/11/04 15:22:03  tng
00029  * C++ Namespace Support.
00030  *
00031  * Revision 1.1.1.1  2002/02/01 22:22:10  peiyongz
00032  * sane_include
00033  *
00034  * Revision 1.3  2000/02/24 20:05:24  abagchi
00035  * Swat for removing Log from API docs
00036  *
00037  * Revision 1.2  2000/02/06 07:48:01  rahulj
00038  * Year 2K copyright swat.
00039  *
00040  * Revision 1.1.1.1  1999/11/09 01:04:07  twl
00041  * Initial checkin
00042  *
00043  * Revision 1.3  1999/11/08 20:45:04  rahul
00044  * Swat for adding in Product name and CVS comment log variable.
00045  *
00046  */
00047 
00048 #if !defined(BINMEMINPUTSTREAM_HPP)
00049 #define BINMEMINPUTSTREAM_HPP
00050 
00051 #include <xercesc/util/BinInputStream.hpp>
00052 #include <xercesc/util/PlatformUtils.hpp>
00053 
00054 XERCES_CPP_NAMESPACE_BEGIN
00055 
00056 class  BinMemInputStream : public BinInputStream
00057 {
00058 public :
00059     // -----------------------------------------------------------------------
00060     //  Class specific types
00061     // -----------------------------------------------------------------------
00062     enum BufOpts
00063     {
00064         BufOpt_Adopt
00065         , BufOpt_Copy
00066         , BufOpt_Reference
00067     };
00068 
00069 
00070     // -----------------------------------------------------------------------
00071     //  Constructors and Destructor
00072     // -----------------------------------------------------------------------
00073     BinMemInputStream
00074     (
00075         const   XMLByte* const  initData
00076         , const unsigned int    capacity
00077         , const BufOpts         bufOpt = BufOpt_Copy
00078         , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
00079     );
00080     virtual ~BinMemInputStream();
00081 
00082 
00083     // -----------------------------------------------------------------------
00084     //  Stream management methods
00085     // -----------------------------------------------------------------------
00086     void reset();
00087 
00088 
00089     // -----------------------------------------------------------------------
00090     //  Implementation of the input stream interface
00091     // -----------------------------------------------------------------------
00092     virtual unsigned int curPos() const;
00093     virtual unsigned int readBytes
00094     (
00095                 XMLByte* const  toFill
00096         , const unsigned int    maxToRead
00097     );
00098 
00099 
00100 private :
00101     // -----------------------------------------------------------------------
00102     //  Unimplemented constructors and operators
00103     // -----------------------------------------------------------------------
00104     BinMemInputStream(const BinMemInputStream&);
00105     BinMemInputStream& operator=(const BinMemInputStream&); 
00106     // -----------------------------------------------------------------------
00107     //  Private data members
00108     //
00109     //  fBuffer
00110     //      The buffer of bytes that we are streaming.
00111     //
00112     //  fBufOpt
00113     //      Indicates the ownership status of the buffer. The caller can have
00114     //      us adopt it (we delete it), reference it, or just make our own
00115     //      copy of it.
00116     //
00117     //  fCapacity
00118     //      The size of the buffer being streamed.
00119     //
00120     //  fCurIndex
00121     //      The current index where the next byte will be read from. When it
00122     //      hits fCapacity, we are done.
00123     // -----------------------------------------------------------------------
00124     const XMLByte*  fBuffer;
00125     BufOpts         fBufOpt;
00126     unsigned int    fCapacity;
00127     unsigned int    fCurIndex;
00128     MemoryManager*  fMemoryManager;
00129 };
00130 
00131 
00132 // ---------------------------------------------------------------------------
00133 //  BinMemInputStream: Stream management methods
00134 // ---------------------------------------------------------------------------
00135 inline void BinMemInputStream::reset()
00136 {
00137     fCurIndex = 0;
00138 }
00139 
00140 
00141 // ---------------------------------------------------------------------------
00142 //  BinMemInputStream: Implementation of the input stream interface
00143 // ---------------------------------------------------------------------------
00144 inline unsigned int BinMemInputStream::curPos() const
00145 {
00146     return fCurIndex;
00147 }
00148 
00149 XERCES_CPP_NAMESPACE_END
00150 
00151 #endif


Copyright © 1994-2004 The Apache Software Foundation. All Rights Reserved.