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 
41 namespace XALAN_CPP_NAMESPACE {
42 
43 
44 using std::FILE;
45 
47 {
48 public :
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  */
65  const XalanDOMString& theFileName,
66  MemoryManager& theManager,
67  size_type theBufferSize = eDefaultBufferSize);
68 
69  static XalanFileOutputStream*
70  create(
71  const XalanDOMString& theFileName,
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  */
90  const XalanDOMString& theFileName,
91  int theErrorCode,
92  XalanDOMString& theBuffer,
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  */
122  const XalanDOMString& theFileName,
123  int theErrorCode,
124  XalanDOMString& theBuffer,
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 
141 protected:
142 
143  virtual void
144  writeData(
145  const char* theBuffer,
146  size_type theBufferLength);
147 
148  virtual void
149  doFlush();
150 
151 private:
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
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition: XalanVersion.hpp:76
xalanc::XalanOutputStream::size_type
XalanTranscodingServices::size_type size_type
Definition: XalanOutputStream.hpp:57
XalanOutputStream.hpp
xalanc::size_type
size_t size_type
Definition: XalanMap.hpp:46
xalanc::XalanFileOutputStream::XalanFileOutputStreamOpenException
Definition: XalanFileOutputStream.hpp:78
xalanc::operator==
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
Definition: XalanVector.hpp:1118
xalanc::XalanOutputStream
Definition: XalanOutputStream.hpp:49
XALAN_PLATFORMSUPPORT_EXPORT
#define XALAN_PLATFORMSUPPORT_EXPORT
Definition: PlatformSupportDefinitions.hpp:35
PlatformSupportDefinitions.hpp
xalanc::XalanFileOutputStream::XalanFileOutputStreamWriteException::getType
virtual const XalanDOMChar * getType() const
Retrieve type of exception.
Definition: XalanFileOutputStream.hpp:131
xalanc::XalanFileOutputStream::XalanFileOutputStreamWriteException
Definition: XalanFileOutputStream.hpp:110
xalanc::XalanOutputStream::XalanOutputStreamException
Definition: XalanOutputStream.hpp:288
xalanc::XalanFileOutputStream
Definition: XalanFileOutputStream.hpp:46
xalanc::XalanFileOutputStream::XalanFileOutputStreamOpenException::getType
virtual const XalanDOMChar * getType() const
Retrieve type of exception.
Definition: XalanFileOutputStream.hpp:99
xalanc::XalanFileOutputStream::HandleType
FILE * HandleType
Definition: XalanFileOutputStream.hpp:55
xalanc::XalanDOMString
Definition: XalanDOMString.hpp:45