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  

LocalFileFormatTarget.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 2002,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  * $Id: LocalFileFormatTarget.hpp,v 1.7 2004/09/08 13:55:57 peiyongz Exp $
00019  * $Log: LocalFileFormatTarget.hpp,v $
00020  * Revision 1.7  2004/09/08 13:55:57  peiyongz
00021  * Apache License Version 2.0
00022  *
00023  * Revision 1.6  2003/05/16 21:36:55  knoaman
00024  * Memory manager implementation: Modify constructors to pass in the memory manager.
00025  *
00026  * Revision 1.5  2003/05/15 18:26:07  knoaman
00027  * Partial implementation of the configurable memory manager.
00028  *
00029  * Revision 1.4  2003/01/24 20:20:22  tng
00030  * Add method flush to XMLFormatTarget
00031  *
00032  * Revision 1.3  2002/11/27 18:09:25  tng
00033  * [Bug 13447] Performance: Using LocalFileFormatTarget with DOMWriter is very slow.
00034  *
00035  * Revision 1.2  2002/11/04 15:00:21  tng
00036  * C++ Namespace Support.
00037  *
00038  * Revision 1.1  2002/06/19 21:59:26  peiyongz
00039  * DOM3:DOMSave Interface support: LocalFileFormatTarget
00040  *
00041  *
00042  */
00043 
00044 #ifndef LocalFileFormatTarget_HEADER_GUARD_
00045 #define LocalFileFormatTarget_HEADER_GUARD_
00046 
00047 #include <xercesc/framework/XMLFormatter.hpp>
00048 
00049 XERCES_CPP_NAMESPACE_BEGIN
00050 
00051 class  LocalFileFormatTarget : public XMLFormatTarget {
00052 public:
00053 
00056     LocalFileFormatTarget
00057     (
00058         const XMLCh* const
00059         , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
00060     );
00061 
00062     LocalFileFormatTarget
00063     (
00064         const char* const
00065         , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
00066     );
00067 
00068     ~LocalFileFormatTarget();
00070 
00071     // -----------------------------------------------------------------------
00072     //  Implementations of the format target interface
00073     // -----------------------------------------------------------------------
00074     virtual void writeChars(const XMLByte* const toWrite
00075                           , const unsigned int   count
00076                           , XMLFormatter* const  formatter);
00077 
00078     virtual void flush();
00079 
00080 private:
00081     // -----------------------------------------------------------------------
00082     //  Unimplemented methods.
00083     // -----------------------------------------------------------------------
00084     LocalFileFormatTarget(const LocalFileFormatTarget&);
00085     LocalFileFormatTarget& operator=(const LocalFileFormatTarget&);
00086 
00087     // -----------------------------------------------------------------------
00088     //  Private helpers
00089     // -----------------------------------------------------------------------
00090     void flushBuffer();
00091     void insureCapacity(const unsigned int extraNeeded);
00092 
00093     // -----------------------------------------------------------------------
00094     //  Private data members
00095     //
00096     //  fSource
00097     //      The source file that we represent. The FileHandle type is defined
00098     //      per platform.
00099     //
00100     //  fDataBuf
00101     //      The pointer to the buffer data. Its always
00102     //      one larger than fCapacity, to leave room for the null terminator.
00103     //
00104     //  fIndex
00105     //      The current index into the buffer, as characters are appended
00106     //      to it. If its zero, then the buffer is empty.
00107     //
00108     //  fCapacity
00109     //      The current capacity of the buffer. Its actually always one
00110     //      larger, to leave room for the null terminator.
00111     // -----------------------------------------------------------------------
00112     FileHandle      fSource;
00113     XMLByte*        fDataBuf;
00114     unsigned int    fIndex;
00115     unsigned int    fCapacity;
00116     MemoryManager*  fMemoryManager;
00117 };
00118 
00119 
00120 XERCES_CPP_NAMESPACE_END
00121 
00122 #endif
00123 


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