SourceForge.net Logo
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 
26 
27 XERCES_CPP_NAMESPACE_BEGIN
28 
29 class XMLPARSER_EXPORT LocalFileFormatTarget : public XMLFormatTarget {
30 public:
31 
35  (
36  const XMLCh* const
37  , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
38  );
39 
41  (
42  const char* const
43  , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
44  );
45 
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  // -----------------------------------------------------------------------
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
Configurable memory manager.
Definition: MemoryManager.hpp:39
virtual void writeChars(const XMLByte *const toWrite, const XMLSize_t count, XMLFormatter *const formatter)=0
virtual void flush()
Definition: XMLFormatter.hpp:461
Definition: LocalFileFormatTarget.hpp:29
This class provides the basic formatting capabilities that are required to turn the Unicode based XML...
Definition: XMLFormatter.hpp:41
Definition: XMLFormatter.hpp:442