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  

MemBufInputSource.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: MemBufInputSource.hpp,v $
00019  * Revision 1.9  2004/09/28 02:14:13  cargilld
00020  * Add support for validating annotations.
00021  *
00022  * Revision 1.8  2004/09/08 13:55:57  peiyongz
00023  * Apache License Version 2.0
00024  *
00025  * Revision 1.7  2004/01/29 11:46:29  cargilld
00026  * Code cleanup changes to get rid of various compiler diagnostic messages.
00027  *
00028  * Revision 1.6  2003/12/01 23:23:25  neilg
00029  * fix for bug 25118; thanks to Jeroen Witmond
00030  *
00031  * Revision 1.5  2003/07/30 14:48:38  peiyongz
00032  * Allow default value
00033  *
00034  * Revision 1.4  2003/05/16 21:36:55  knoaman
00035  * Memory manager implementation: Modify constructors to pass in the memory manager.
00036  *
00037  * Revision 1.3  2002/11/04 15:00:21  tng
00038  * C++ Namespace Support.
00039  *
00040  * Revision 1.2  2002/02/20 18:17:01  tng
00041  * [Bug 5977] Warnings on generating apiDocs.
00042  *
00043  * Revision 1.1.1.1  2002/02/01 22:21:50  peiyongz
00044  * sane_include
00045  *
00046  * Revision 1.6  2000/12/14 18:49:54  tng
00047  * Fix API document generation warning: "Warning: end of member group without matching begin"
00048  *
00049  * Revision 1.5  2000/02/24 20:00:22  abagchi
00050  * Swat for removing Log from API docs
00051  *
00052  * Revision 1.4  2000/02/15 23:59:06  roddey
00053  * More updated documentation of Framework classes.
00054  *
00055  * Revision 1.3  2000/02/15 01:21:30  roddey
00056  * Some initial documentation improvements. More to come...
00057  *
00058  * Revision 1.2  2000/02/06 07:47:46  rahulj
00059  * Year 2K copyright swat.
00060  *
00061  * Revision 1.1  2000/01/12 00:13:26  roddey
00062  * These were moved from internal/ to framework/, which was something that should have
00063  * happened long ago. They are really framework type of classes.
00064  *
00065  * Revision 1.1.1.1  1999/11/09 01:08:10  twl
00066  * Initial checkin
00067  *
00068  * Revision 1.2  1999/11/08 20:44:43  rahul
00069  * Swat for adding in Product name and CVS comment log variable.
00070  *
00071  */
00072 
00073 
00074 #if !defined(MEMBUFINPUTSOURCE_HPP)
00075 #define MEMBUFINPUTSOURCE_HPP
00076 
00077 #include <xercesc/sax/InputSource.hpp>
00078 
00079 XERCES_CPP_NAMESPACE_BEGIN
00080 
00081 class BinInputStream;
00082 
00083 
00112 class  MemBufInputSource : public InputSource
00113 {
00114 public :
00115     // -----------------------------------------------------------------------
00116     //  Constructors and Destructor
00117     // -----------------------------------------------------------------------
00118 
00121 
00143     MemBufInputSource
00144     (
00145         const   XMLByte* const  srcDocBytes
00146         , const unsigned int    byteCount
00147         , const XMLCh* const    bufId
00148         , const bool            adoptBuffer = false
00149         , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
00150     );
00151 
00156     MemBufInputSource
00157     (
00158         const   XMLByte* const  srcDocBytes
00159         , const unsigned int    byteCount
00160         , const char* const     bufId
00161         , const bool            adoptBuffer = false
00162         , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
00163     );
00165 
00172     ~MemBufInputSource();
00174 
00175 
00176     // -----------------------------------------------------------------------
00177     //  Virtual input source interface
00178     // -----------------------------------------------------------------------
00179 
00182 
00193     BinInputStream* makeStream() const;
00194 
00196 
00197 
00198     // -----------------------------------------------------------------------
00199     //  Setter methods
00200     // -----------------------------------------------------------------------
00201 
00205 
00221     void setCopyBufToStream(const bool newState);
00222 
00232     void resetMemBufInputSource(const   XMLByte* const  srcDocBytes
00233                                 , const unsigned int    byteCount);
00235 
00236 
00237 private :
00238     // -----------------------------------------------------------------------
00239     //  Unimplemented constructors and operators
00240     // -----------------------------------------------------------------------
00241     MemBufInputSource(const MemBufInputSource&);
00242     MemBufInputSource& operator=(const MemBufInputSource&);
00243 
00244     // -----------------------------------------------------------------------
00245     //  Private data members
00246     //
00247     //  fAdopted
00248     //      Indicates whether the buffer is adopted or not. If so, then it
00249     //      is destroyed when the input source is destroyed.
00250     //
00251     //  fByteCount
00252     //      The size of the source document.
00253     //
00254     //  fCopyBufToStream
00255     //      This defaults to true (the safe option), which causes it to
00256     //      give a copy of the buffer to any streams it creates. If you set
00257     //      it to false, it will allow the streams to just reference the
00258     //      buffer (in which case this input source must stay alive as long
00259     //      as the buffer is in use by the stream.)
00260     //
00261     //  fSrcBytes
00262     //      The source memory buffer that is being spooled from. Whether it
00263     //      belongs to the this input source or not is controlled by the
00264     //      fAdopted flag.
00265     // -----------------------------------------------------------------------
00266     bool            fAdopted;
00267     unsigned int    fByteCount;
00268     bool            fCopyBufToStream;
00269     const XMLByte*  fSrcBytes;
00270 };
00271 
00272 
00273 inline void MemBufInputSource::setCopyBufToStream(const bool newState)
00274 {
00275     fCopyBufToStream = newState;
00276 }
00277 
00278 XERCES_CPP_NAMESPACE_END
00279 
00280 #endif


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