source: NonGTP/Xerces/xerces/include/xercesc/framework/LocalFileFormatTarget.hpp @ 358

Revision 358, 4.1 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1/*
2 * Copyright 2002,2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * $Id: LocalFileFormatTarget.hpp,v 1.7 2004/09/08 13:55:57 peiyongz Exp $
19 * $Log: LocalFileFormatTarget.hpp,v $
20 * Revision 1.7  2004/09/08 13:55:57  peiyongz
21 * Apache License Version 2.0
22 *
23 * Revision 1.6  2003/05/16 21:36:55  knoaman
24 * Memory manager implementation: Modify constructors to pass in the memory manager.
25 *
26 * Revision 1.5  2003/05/15 18:26:07  knoaman
27 * Partial implementation of the configurable memory manager.
28 *
29 * Revision 1.4  2003/01/24 20:20:22  tng
30 * Add method flush to XMLFormatTarget
31 *
32 * Revision 1.3  2002/11/27 18:09:25  tng
33 * [Bug 13447] Performance: Using LocalFileFormatTarget with DOMWriter is very slow.
34 *
35 * Revision 1.2  2002/11/04 15:00:21  tng
36 * C++ Namespace Support.
37 *
38 * Revision 1.1  2002/06/19 21:59:26  peiyongz
39 * DOM3:DOMSave Interface support: LocalFileFormatTarget
40 *
41 *
42 */
43
44#ifndef LocalFileFormatTarget_HEADER_GUARD_
45#define LocalFileFormatTarget_HEADER_GUARD_
46
47#include <xercesc/framework/XMLFormatter.hpp>
48
49XERCES_CPP_NAMESPACE_BEGIN
50
51class XMLPARSER_EXPORT LocalFileFormatTarget : public XMLFormatTarget {
52public:
53
54    /** @name constructors and destructor */
55    //@{
56    LocalFileFormatTarget
57    (
58        const XMLCh* const
59        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
60    );
61
62    LocalFileFormatTarget
63    (
64        const char* const
65        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
66    );
67
68    ~LocalFileFormatTarget();
69    //@}
70
71    // -----------------------------------------------------------------------
72    //  Implementations of the format target interface
73    // -----------------------------------------------------------------------
74    virtual void writeChars(const XMLByte* const toWrite
75                          , const unsigned int   count
76                          , XMLFormatter* const  formatter);
77
78    virtual void flush();
79
80private:
81    // -----------------------------------------------------------------------
82    //  Unimplemented methods.
83    // -----------------------------------------------------------------------
84    LocalFileFormatTarget(const LocalFileFormatTarget&);
85    LocalFileFormatTarget& operator=(const LocalFileFormatTarget&);
86
87    // -----------------------------------------------------------------------
88    //  Private helpers
89    // -----------------------------------------------------------------------
90    void flushBuffer();
91    void insureCapacity(const unsigned int extraNeeded);
92
93    // -----------------------------------------------------------------------
94    //  Private data members
95    //
96    //  fSource
97    //      The source file that we represent. The FileHandle type is defined
98    //      per platform.
99    //
100    //  fDataBuf
101    //      The pointer to the buffer data. Its always
102    //      one larger than fCapacity, to leave room for the null terminator.
103    //
104    //  fIndex
105    //      The current index into the buffer, as characters are appended
106    //      to it. If its zero, then the buffer is empty.
107    //
108    //  fCapacity
109    //      The current capacity of the buffer. Its actually always one
110    //      larger, to leave room for the null terminator.
111    // -----------------------------------------------------------------------
112    FileHandle      fSource;
113    XMLByte*        fDataBuf;
114    unsigned int    fIndex;
115    unsigned int    fCapacity;
116    MemoryManager*  fMemoryManager;
117};
118
119
120XERCES_CPP_NAMESPACE_END
121
122#endif
123
Note: See TracBrowser for help on using the repository browser.