Xerces-C++ 3.2.0

LocalFileFormatTarget.hpp
Go to the documentation of this file.
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 /*
19 * $Id: LocalFileFormatTarget.hpp 932889 2010-04-11 13:10:10Z borisk $
20 */
21
22 #if !defined(XERCESC_INCLUDE_GUARD_LOCALFILEFORMATTARGET_HPP)
23 #define XERCESC_INCLUDE_GUARD_LOCALFILEFORMATTARGET_HPP
24
25 #include <xercesc/framework/XMLFormatter.hpp>
26
27 XERCES_CPP_NAMESPACE_BEGIN
28
29 class XMLPARSER_EXPORT LocalFileFormatTarget : public XMLFormatTarget {
30 public:
31
34 LocalFileFormatTarget
35 (
36 const XMLCh* const
37 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
38 );
39
40 LocalFileFormatTarget
41 (
42 const char* const
43 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
44 );
45
46 ~LocalFileFormatTarget();
48
49 // -----------------------------------------------------------------------
50 // Implementations of the format target interface
51 // -----------------------------------------------------------------------
52 virtual void writeChars(const XMLByte* const toWrite
53 , const XMLSize_t count
54 , XMLFormatter* const formatter);
55
56 virtual void flush();
57
58 private:
59 // -----------------------------------------------------------------------
60 // Unimplemented methods.
61 // -----------------------------------------------------------------------
62 LocalFileFormatTarget(const LocalFileFormatTarget&);
63 LocalFileFormatTarget& operator=(const LocalFileFormatTarget&);
64
65 // -----------------------------------------------------------------------
66 // Private helpers
67 // -----------------------------------------------------------------------
68 void ensureCapacity(const XMLSize_t extraNeeded);
69
70 // -----------------------------------------------------------------------
71 // Private data members
72 //
73 // fSource
74 // The source file that we represent. The FileHandle type is defined
75 // per platform.
76 //
77 // fDataBuf
78 // The pointer to the buffer data. Its always
79 // one larger than fCapacity, to leave room for the null terminator.
80 //
81 // fIndex
82 // The current index into the buffer, as characters are appended
83 // to it. If its zero, then the buffer is empty.
84 //
85 // fCapacity
86 // The current capacity of the buffer. Its actually always one
87 // larger, to leave room for the null terminator.
88 // -----------------------------------------------------------------------
89 FileHandle fSource;
90 XMLByte* fDataBuf;
91 XMLSize_t fIndex;
92 XMLSize_t fCapacity;
93 MemoryManager* fMemoryManager;
94 };
95
96
97 XERCES_CPP_NAMESPACE_END
98
99 #endif
XMLFormatTarget::flush
virtual void flush()
Definition: XMLFormatter.hpp:461
XMLFormatTarget::writeChars
virtual void writeChars(const XMLByte *const toWrite, const XMLSize_t count, XMLFormatter *const formatter)=0
XMLPlatformUtils::fgMemoryManager
static MemoryManager * fgMemoryManager
The configurable memory manager.
Definition: PlatformUtils.hpp:121
XMLFormatter
This class provides the basic formatting capabilities that are required to turn the Unicode based XML...
Definition: XMLFormatter.hpp:41
XMLPARSER_EXPORT
#define XMLPARSER_EXPORT
Definition: XercesDefs.hpp:163
XMLFormatter.hpp
MemoryManager
Configurable memory manager.
Definition: MemoryManager.hpp:39
XMLCh
uint16_t XMLCh
Definition: Xerces_autoconf_config.hpp:118
XERCES_CPP_NAMESPACE_BEGIN
#define XERCES_CPP_NAMESPACE_BEGIN
Definition: XercesDefs.hpp:112
FileHandle
XERCES_CPP_NAMESPACE_BEGIN typedef void * FileHandle
Definition: XMLFileMgr.hpp:30
LocalFileFormatTarget
Definition: LocalFileFormatTarget.hpp:29
XMLByte
unsigned char XMLByte
Definition: XercesDefs.hpp:65
XMLSize_t
size_t XMLSize_t
Definition: Xerces_autoconf_config.hpp:110
XERCES_CPP_NAMESPACE_END
#define XERCES_CPP_NAMESPACE_END
Definition: XercesDefs.hpp:113
XMLFormatTarget
Definition: XMLFormatter.hpp:442