source: NonGTP/Xerces/xerces-c_2_8_0/include/xercesc/framework/LocalFileFormatTarget.hpp @ 2674

Revision 2674, 3.4 KB checked in by mattausch, 16 years ago (diff)
Line 
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 568078 2007-08-21 11:43:25Z amassari $
20 */
21
22#ifndef LocalFileFormatTarget_HEADER_GUARD_
23#define LocalFileFormatTarget_HEADER_GUARD_
24
25#include <xercesc/framework/XMLFormatter.hpp>
26
27XERCES_CPP_NAMESPACE_BEGIN
28
29class XMLPARSER_EXPORT LocalFileFormatTarget : public XMLFormatTarget {
30public:
31
32    /** @name constructors and destructor */
33    //@{
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();
47    //@}
48
49    // -----------------------------------------------------------------------
50    //  Implementations of the format target interface
51    // -----------------------------------------------------------------------
52    virtual void writeChars(const XMLByte* const toWrite
53                          , const unsigned int   count
54                          , XMLFormatter* const  formatter);
55
56    virtual void flush();
57
58private:
59    // -----------------------------------------------------------------------
60    //  Unimplemented methods.
61    // -----------------------------------------------------------------------
62    LocalFileFormatTarget(const LocalFileFormatTarget&);
63    LocalFileFormatTarget& operator=(const LocalFileFormatTarget&);
64
65    // -----------------------------------------------------------------------
66    //  Private helpers
67    // -----------------------------------------------------------------------
68    void flushBuffer();
69    bool insureCapacity(const unsigned int extraNeeded);
70
71    // -----------------------------------------------------------------------
72    //  Private data members
73    //
74    //  fSource
75    //      The source file that we represent. The FileHandle type is defined
76    //      per platform.
77    //
78    //  fDataBuf
79    //      The pointer to the buffer data. Its always
80    //      one larger than fCapacity, to leave room for the null terminator.
81    //
82    //  fIndex
83    //      The current index into the buffer, as characters are appended
84    //      to it. If its zero, then the buffer is empty.
85    //
86    //  fCapacity
87    //      The current capacity of the buffer. Its actually always one
88    //      larger, to leave room for the null terminator.
89    // -----------------------------------------------------------------------
90    FileHandle      fSource;
91    XMLByte*        fDataBuf;
92    unsigned int    fIndex;
93    unsigned int    fCapacity;
94    MemoryManager*  fMemoryManager;
95};
96
97
98XERCES_CPP_NAMESPACE_END
99
100#endif
101
Note: See TracBrowser for help on using the repository browser.