Xerces-C++ 3.2.4

InputSource.hpp
Go to the documentation of this file.
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$
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_INPUTSOURCE_HPP)
23#define XERCESC_INCLUDE_GUARD_INPUTSOURCE_HPP
24
25#include <xercesc/util/PlatformUtils.hpp>
26
27 XERCES_CPP_NAMESPACE_BEGIN
28
29 class BinInputStream;
30
31
62 class SAX_EXPORT InputSource : public XMemory
63{
64 public:
65 // -----------------------------------------------------------------------
66 // All constructors are hidden, just the destructor is available
67 // -----------------------------------------------------------------------
74 virtual ~InputSource();
76
77
78 // -----------------------------------------------------------------------
91 virtual BinInputStream* makeStream() const = 0;
92
94
95
96 // -----------------------------------------------------------------------
108 virtual const XMLCh* getEncoding() const;
109
110
117 virtual const XMLCh* getPublicId() const;
118
119
128 virtual const XMLCh* getSystemId() const;
129
138 virtual bool getIssueFatalErrorIfNotFound() const;
139
140 MemoryManager* getMemoryManager() const;
141
143
144
145 // -----------------------------------------------------------------------
148
160 virtual void setEncoding(const XMLCh* const encodingStr);
161
162
174 virtual void setPublicId(const XMLCh* const publicId);
175
192 virtual void setSystemId(const XMLCh* const systemId);
193
203 virtual void setIssueFatalErrorIfNotFound(const bool flag);
204
206
207
208protected :
209 // -----------------------------------------------------------------------
210 // Hidden constructors
211 // -----------------------------------------------------------------------
215 InputSource(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
216
222 InputSource(const XMLCh* const systemId,
223 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
224
231 InputSource
232 (
233 const XMLCh* const systemId
234 , const XMLCh* const publicId
235 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
236 );
237
243 InputSource(const char* const systemId,
244 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
245
252 InputSource
253 (
254 const char* const systemId
255 , const char* const publicId
256 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
257 );
258
260
261
262
263
264
265 private:
266 // -----------------------------------------------------------------------
267 // Unimplemented constructors and operators
268 // -----------------------------------------------------------------------
269 InputSource(const InputSource&);
270 InputSource& operator=(const InputSource&);
271
272
273 // -----------------------------------------------------------------------
274 // Private data members
275 //
276 // fEncoding
277 // This is the encoding to use. Usually this is null, which means
278 // to use the information found in the file itself. But, if set,
279 // this encoding will be used without question.
280 //
281 // fPublicId
282 // This is the optional public id for the input source. It can be
283 // null if none is desired.
284 //
285 // fSystemId
286 // This is the system id for the input source. This is what is
287 // actually used to open the source.
288 //
289 // fFatalErrorIfNotFound
290 // -----------------------------------------------------------------------
291 MemoryManager* const fMemoryManager;
292 XMLCh* fEncoding;
293 XMLCh* fPublicId;
294 XMLCh* fSystemId;
295 bool fFatalErrorIfNotFound;
296};
297
298
299// ---------------------------------------------------------------------------
300// InputSource: Getter methods
301// ---------------------------------------------------------------------------
302 inline const XMLCh* InputSource::getEncoding() const
303{
304 return fEncoding;
305}
306
307 inline const XMLCh* InputSource::getPublicId() const
308{
309 return fPublicId;
310}
311
312 inline const XMLCh* InputSource::getSystemId() const
313{
314 return fSystemId;
315}
316
317 inline bool InputSource::getIssueFatalErrorIfNotFound() const
318{
319 return fFatalErrorIfNotFound;
320}
321
322 inline MemoryManager* InputSource::getMemoryManager() const
323{
324 return fMemoryManager;
325}
326
327// ---------------------------------------------------------------------------
328// InputSource: Setter methods
329// ---------------------------------------------------------------------------
330 inline void InputSource::setIssueFatalErrorIfNotFound(const bool flag)
331{
332 fFatalErrorIfNotFound = flag;
333}
334
335 XERCES_CPP_NAMESPACE_END
336
337#endif
PlatformUtils.hpp
XERCES_CPP_NAMESPACE_BEGIN
#define XERCES_CPP_NAMESPACE_BEGIN
Definition: XercesDefs.hpp:112
SAX_EXPORT
#define SAX_EXPORT
Definition: XercesDefs.hpp:164
XERCES_CPP_NAMESPACE_END
#define XERCES_CPP_NAMESPACE_END
Definition: XercesDefs.hpp:113
XMLCh
uint16_t XMLCh
Definition: Xerces_autoconf_config.hpp:120
BinInputStream
Definition: BinInputStream.hpp:30
InputSource
A single input source for an XML entity.
Definition: InputSource.hpp:63
InputSource::setSystemId
virtual void setSystemId(const XMLCh *const systemId)
Set the system identifier for this input source.
InputSource::~InputSource
virtual ~InputSource()
Destructor.
InputSource::getMemoryManager
MemoryManager * getMemoryManager() const
Definition: InputSource.hpp:322
InputSource::getEncoding
virtual const XMLCh * getEncoding() const
An input source can be set to force the parser to assume a particular encoding for the data that inpu...
Definition: InputSource.hpp:302
InputSource::setPublicId
virtual void setPublicId(const XMLCh *const publicId)
Set the public identifier for this input source.
InputSource::InputSource
InputSource(MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Default constructor.
InputSource::InputSource
InputSource(const XMLCh *const systemId, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Constructor with a system identifier as XMLCh type.
InputSource::setEncoding
virtual void setEncoding(const XMLCh *const encodingStr)
Set the encoding which will be required for use with the XML text read via a stream opened by this in...
InputSource::setIssueFatalErrorIfNotFound
virtual void setIssueFatalErrorIfNotFound(const bool flag)
Indicates if the parser should issue fatal error if this input source is not found.
Definition: InputSource.hpp:330
InputSource::getIssueFatalErrorIfNotFound
virtual bool getIssueFatalErrorIfNotFound() const
Get the flag that indicates if the parser should issue fatal error if this input source is not found.
Definition: InputSource.hpp:317
InputSource::InputSource
InputSource(const char *const systemId, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Constructor witha system identifier as string.
InputSource::makeStream
virtual BinInputStream * makeStream() const =0
Makes the byte stream for this input source.
InputSource::getPublicId
virtual const XMLCh * getPublicId() const
Get the public identifier for this input source.
Definition: InputSource.hpp:307
InputSource::getSystemId
virtual const XMLCh * getSystemId() const
Get the system identifier for this input source.
Definition: InputSource.hpp:312
InputSource::InputSource
InputSource(const char *const systemId, const char *const publicId, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Constructor witha system and public identifiers.
InputSource::InputSource
InputSource(const XMLCh *const systemId, const XMLCh *const publicId, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Constructor with a system and public identifiers.
MemoryManager
Configurable memory manager.
Definition: MemoryManager.hpp:40
XMLPlatformUtils::fgMemoryManager
static MemoryManager * fgMemoryManager
The configurable memory manager.
Definition: PlatformUtils.hpp:121
XMemory
This class makes it possible to override the C++ memory management by adding new/delete operators to ...
Definition: XMemory.hpp:41