Xalan-C++ API Reference 1.12.0
XalanFileOutputStream.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18#if !defined(XALANFILEOUTPUTSTREAM_HEADER_GUARD_1357924680)
19#define XALANFILEOUTPUTSTREAM_HEADER_GUARD_1357924680
20
21
22
23// Base include file. Must be first.
25
26
27
28#if defined(XALAN_WINDOWS)
29#include <windows.h>
30#else
31#include <cstdio>
32#endif
33
34
35
36// Base class header file.
38
39
40
41namespace XALAN_CPP_NAMESPACE {
42
43
44using std::FILE;
45
47{
48public :
49
50 enum { eDefaultBufferSize = 8192u };
51
52#if defined(XALAN_WINDOWS)
53 typedef HANDLE HandleType;
54#else
55 typedef FILE* HandleType;
56#endif
57
58 /**
59 * Construct an XalanFileOutputStream object.
60 *
61 * @param theFileName name of file
62 * @param theBufferSize The size of the transcoding buffer
63 */
66 MemoryManager& theManager,
67 size_type theBufferSize = eDefaultBufferSize);
68
72 MemoryManager& theManager,
73 size_type theBufferSize = eDefaultBufferSize);
74 virtual
76
77
79 {
80 public:
81
82 /**
83 * Construct an XalanFileOutputStreamOpen exception object for an exception
84 * that occurred on opening a text file stream.
85 *
86 * @param theFileName name of file causing the exception
87 * @param theErrorCode number of error encountered
88 */
91 int theErrorCode,
93 const Locator* theLocator = 0);
94
95 virtual
97
98 virtual const XalanDOMChar*
99 getType() const
100 {
101 return m_type;
102 }
103
104 private:
105
106 static const XalanDOMChar m_type[];
107
108 };
109
111 {
112 public:
113
114 /**
115 * Construct an XalanFileOutputStreamOpen exception object for an exception
116 * that occurred while writing to a text file stream.
117 *
118 * @param theFileName name of file causing the exception
119 * @param theErrorCode number of error encountered
120 */
123 int theErrorCode,
125 const Locator* theLocator = 0);
126
127 virtual
129
130 virtual const XalanDOMChar*
131 getType() const
132 {
133 return m_type;
134 }
135
136 private:
137 static const XalanDOMChar m_type[];
138
139 };
140
141protected:
142
143 virtual void
145 const char* theBuffer,
147
148 virtual void
150
151private:
152
153 // These are not implemented...
155
157 operator=(const XalanFileOutputStream&);
158
159 bool
160 operator==(const XalanFileOutputStream&) const;
161
162
163 // Data members...
164 const XalanDOMString m_fileName;
165
166 const HandleType m_handle;
167};
168
169
170
171}
172
173
174
175#endif // XALANFILEOUTPUTSTREAM_HEADER_GUARD_1357924680
#define XALAN_PLATFORMSUPPORT_EXPORT
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
virtual const XalanDOMChar * getType() const
Retrieve type of exception.
XalanFileOutputStreamOpenException(const XalanDOMString &theFileName, int theErrorCode, XalanDOMString &theBuffer, const Locator *theLocator=0)
Construct an XalanFileOutputStreamOpen exception object for an exception that occurred on opening a t...
virtual const XalanDOMChar * getType() const
Retrieve type of exception.
XalanFileOutputStreamWriteException(const XalanDOMString &theFileName, int theErrorCode, XalanDOMString &theBuffer, const Locator *theLocator=0)
Construct an XalanFileOutputStreamOpen exception object for an exception that occurred while writing ...
virtual void writeData(const char *theBuffer, size_type theBufferLength)
Write the data in the buffer.
XalanFileOutputStream(const XalanDOMString &theFileName, MemoryManager &theManager, size_type theBufferSize=eDefaultBufferSize)
Construct an XalanFileOutputStream object.
static XalanFileOutputStream * create(const XalanDOMString &theFileName, MemoryManager &theManager, size_type theBufferSize=eDefaultBufferSize)
virtual void doFlush()
Flush the stream.
XalanTranscodingServices::size_type size_type
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)