Xalan-C++ API Reference  1.12.0
MsgFileOutputStream.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 
19 // This file is simplified version of XalanFileOutputStream.hpp / .cpp
20 
21 #if !defined(MSGFILEOUTPUTSTREAM_1357924680)
22 #define MSGFILEOUTPUTSTREAM_1357924680
23 
25 
26 
27 
28 #include <cstdio>
29 
30 
31 
32 namespace XALAN_CPP_NAMESPACE {
33 
34 
35 
36 using namespace xercesc;
37 
38 
39 
40 // Class responsible for printing into file with UTF16
42 {
43 public :
44 
45  typedef std::FILE* HandleType;
46 
47  /**
48  * Construct an MsgFileOutputStream object.
49  *
50  * @param theFileName name of file
51  * @param theBufferSize The size of the transcoding buffer
52  */
53  MsgFileOutputStream(const char* theFileName);
54 
55  virtual
57 
58 
60  {
61  public:
62 
63  /**
64  * Construct an OpenException exception object for an exception
65  * that occurred when opening a file.
66  *
67  * @param theFileName The name of file.
68  * @param theErrorCode The errno for the error encountered
69  */
71  const char* theFileName,
72  int theErrorCode);
73 
74  ~OpenException();
75 
76  char m_message[1200];
77  };
78 
80  {
81  public:
82 
83  /**
84  * Construct an WriteException exception object for an exception
85  * that occurred while writing to a file.
86  *
87  * @param theFileName The name of file.
88  * @param theErrorCode The errno for the error encountered
89  */
91  const char* theFileName,
92  int theErrorCode);
93 
94  ~WriteException();
95 
96  char m_message[1200];
97  };
98 
99  void
100  write(
101  const XMLCh* theString,
102  XalanSize_t theLength);
103 
104  void
105  write(
106  const char* theString,
107  XalanSize_t theLength);
108 
109  void
110  writeAsASCII(
111  const char* theString,
112  XalanSize_t theLength);
113 
114  void
115  writeAsASCII(
116  const XMLCh* theString,
117  XalanSize_t theLength);
118 
119  void
120  writeUTFPrefix();
121 
122 protected:
123 
124  void
125  writeData(
126  const char* theBuffer,
127  XalanSize_t theBufferLength);
128 
129  void
130  doFlush();
131 
132 private:
133 
134  // These are not implemented...
136 
138  operator=(const MsgFileOutputStream&);
139 
140  bool
141  operator==(const MsgFileOutputStream&) const;
142 
143 
144  // Data members...
145  const char* const m_fileName;
146 
147  const HandleType m_handle;
148 };
149 
150 
151 
152 }
153 
154 
155 
156 #endif // MSGFILEOUTPUTSTREAM_1357924680
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition: XalanVersion.hpp:76
xalanc::MsgFileOutputStream::OpenException
Definition: MsgFileOutputStream.hpp:59
xalanc::MsgFileOutputStream::WriteException
Definition: MsgFileOutputStream.hpp:79
xalanc::operator==
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
Definition: XalanVector.hpp:1118
xercesc
Definition: DOMSupportDefault.hpp:32
PlatformDefinitions.hpp
xalanc::MsgFileOutputStream
Definition: MsgFileOutputStream.hpp:41
xalanc::MsgFileOutputStream::HandleType
std::FILE * HandleType
Definition: MsgFileOutputStream.hpp:45