Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:27:04

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  *
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  *
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_LOCALFILEFORMATTARGET_HPP)
0023 #define XERCESC_INCLUDE_GUARD_LOCALFILEFORMATTARGET_HPP
0024 
0025 #include <xercesc/framework/XMLFormatter.hpp>
0026 
0027 XERCES_CPP_NAMESPACE_BEGIN
0028 
0029 class XMLPARSER_EXPORT LocalFileFormatTarget : public XMLFormatTarget {
0030 public:
0031 
0032     /** @name constructors and destructor */
0033     //@{
0034     LocalFileFormatTarget
0035     (
0036         const XMLCh* const
0037         , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
0038     );
0039 
0040     LocalFileFormatTarget
0041     (
0042         const char* const
0043         , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
0044     );
0045 
0046     ~LocalFileFormatTarget();
0047     //@}
0048 
0049     // -----------------------------------------------------------------------
0050     //  Implementations of the format target interface
0051     // -----------------------------------------------------------------------
0052     virtual void writeChars(const XMLByte* const toWrite
0053                           , const XMLSize_t      count
0054                           , XMLFormatter* const  formatter);
0055 
0056     virtual void flush();
0057 
0058 private:
0059     // -----------------------------------------------------------------------
0060     //  Unimplemented methods.
0061     // -----------------------------------------------------------------------
0062     LocalFileFormatTarget(const LocalFileFormatTarget&);
0063     LocalFileFormatTarget& operator=(const LocalFileFormatTarget&);
0064 
0065     // -----------------------------------------------------------------------
0066     //  Private helpers
0067     // -----------------------------------------------------------------------
0068     void ensureCapacity(const XMLSize_t extraNeeded);
0069 
0070     // -----------------------------------------------------------------------
0071     //  Private data members
0072     //
0073     //  fSource
0074     //      The source file that we represent. The FileHandle type is defined
0075     //      per platform.
0076     //
0077     //  fDataBuf
0078     //      The pointer to the buffer data. Its always
0079     //      one larger than fCapacity, to leave room for the null terminator.
0080     //
0081     //  fIndex
0082     //      The current index into the buffer, as characters are appended
0083     //      to it. If its zero, then the buffer is empty.
0084     //
0085     //  fCapacity
0086     //      The current capacity of the buffer. Its actually always one
0087     //      larger, to leave room for the null terminator.
0088     // -----------------------------------------------------------------------
0089     FileHandle      fSource;
0090     XMLByte*        fDataBuf;
0091     XMLSize_t       fIndex;
0092     XMLSize_t       fCapacity;
0093     MemoryManager*  fMemoryManager;
0094 };
0095 
0096 
0097 XERCES_CPP_NAMESPACE_END
0098 
0099 #endif