Xalan-C++ API Reference  1.12.0
Writer.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(WRITER_HEADER_GUARD_1357924680)
19 #define WRITER_HEADER_GUARD_1357924680
20 
21 
22 
23 // Base include file. Must be first.
25 
26 
27 
28 #include <cstddef>
29 
30 
31 
33 
34 
35 
36 namespace XALAN_CPP_NAMESPACE {
37 
38 
39 
40 class XalanOutputStream;
41 
42 
43 
45 {
46 public:
47 
48  Writer();
49 
50  virtual
51  ~Writer();
52 
53  /**
54  * Close the stream
55  */
56  virtual void
57  close() = 0;
58 
59  /**
60  * Flush the stream
61  */
62  virtual void
63  flush() = 0;
64 
65  /**
66  * Get the stream associated with the writer...
67  */
68  virtual XalanOutputStream*
69  getStream();
70 
71  /**
72  * Get the stream associated with the writer...
73  */
74  virtual const XalanOutputStream*
75  getStream() const;
76 
77 
78  // Output functions
79 
80  static const size_t npos;
81 
82  /**
83  * Writes a string
84  *
85  * @param s string to write
86  * @param theOffset starting offset in string to begin writing, default 0
87  * @param theLength number of characters to write. If the length is npos, then the array is assumed to be null-terminated.
88  */
89  virtual void
90  write(
91  const char* s,
92  size_t theOffset = 0,
93  size_t theLength = npos) = 0;
94 
95  /**
96  * Writes a string
97  *
98  * @param s string to write
99  * @param theOffset starting offset in string to begin writing, default 0
100  * @param theLength number of characters to write. If the length is XalanDOMString::npos, then the array is assumed to be null-terminated.
101  */
102  virtual void
103  write(
104  const XalanDOMChar* s,
105  XalanDOMString::size_type theOffset = 0,
106  XalanDOMString::size_type theLength = XalanDOMString::npos) = 0;
107 
108  /**
109  * Writes a character
110  *
111  * @param c character to write
112  */
113  virtual void
114  write(XalanDOMChar c) = 0;
115 
116  /**
117  * Writes a string
118  *
119  * @param s string to write
120  * @param theOffset starting offset in string to begin writing, default 0
121  * @param theLength number of characters to write. If the length is XalanDOMString::npos, then the entire string is printed.
122  */
123  virtual void
124  write(
125  const XalanDOMString& s,
126  XalanDOMString::size_type theOffset = 0,
127  XalanDOMString::size_type theLength = XalanDOMString::npos) = 0;
128 
129 private:
130 
131  // Not implemented
132  Writer(const Writer&);
133 
134  Writer&
135  operator=(const Writer&);
136 
137  bool
138  operator==(const Writer&);
139 };
140 
141 
142 
143 }
144 
145 
146 
147 #endif // WRITER_HEADER_GUARD_1357924680
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition: XalanVersion.hpp:76
XalanDOMString.hpp
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::XalanDOMString::size_type
XalanSize_t size_type
Definition: XalanDOMString.hpp:57
xalanc::Writer::npos
static const size_t npos
Definition: Writer.hpp:80
xalanc::XalanDOMString
Definition: XalanDOMString.hpp:45
xalanc::Writer
Definition: Writer.hpp:44