InputSource.hpp
Go to the documentation of this file.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id$
*/
#if !defined(XERCESC_INCLUDE_GUARD_INPUTSOURCE_HPP)
#define XERCESC_INCLUDE_GUARD_INPUTSOURCE_HPP
#include <xercesc/util/PlatformUtils.hpp>
XERCES_CPP_NAMESPACE_BEGIN
class BinInputStream;
class SAX_EXPORT InputSource : public XMemory
{
public:
// -----------------------------------------------------------------------
// All constructors are hidden, just the destructor is available
// -----------------------------------------------------------------------
virtual ~InputSource();
// -----------------------------------------------------------------------
virtual BinInputStream* makeStream() const = 0;
// -----------------------------------------------------------------------
virtual const XMLCh* getEncoding() const;
virtual const XMLCh* getPublicId() const;
virtual const XMLCh* getSystemId() const;
virtual bool getIssueFatalErrorIfNotFound() const;
MemoryManager* getMemoryManager() const;
// -----------------------------------------------------------------------
virtual void setEncoding(const XMLCh* const encodingStr);
virtual void setPublicId(const XMLCh* const publicId);
virtual void setSystemId(const XMLCh* const systemId);
virtual void setIssueFatalErrorIfNotFound(const bool flag);
protected :
// -----------------------------------------------------------------------
// Hidden constructors
// -----------------------------------------------------------------------
InputSource(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
InputSource(const XMLCh* const systemId,
MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
InputSource
(
const XMLCh* const systemId
, const XMLCh* const publicId
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
InputSource(const char* const systemId,
MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
InputSource
(
const char* const systemId
, const char* const publicId
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
private:
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
InputSource(const InputSource&);
InputSource& operator=(const InputSource&);
// -----------------------------------------------------------------------
// Private data members
//
// fEncoding
// This is the encoding to use. Usually this is null, which means
// to use the information found in the file itself. But, if set,
// this encoding will be used without question.
//
// fPublicId
// This is the optional public id for the input source. It can be
// null if none is desired.
//
// fSystemId
// This is the system id for the input source. This is what is
// actually used to open the source.
//
// fFatalErrorIfNotFound
// -----------------------------------------------------------------------
MemoryManager* const fMemoryManager;
XMLCh* fEncoding;
XMLCh* fPublicId;
XMLCh* fSystemId;
bool fFatalErrorIfNotFound;
};
// ---------------------------------------------------------------------------
// InputSource: Getter methods
// ---------------------------------------------------------------------------
inline const XMLCh* InputSource::getEncoding() const
{
return fEncoding;
}
inline const XMLCh* InputSource::getPublicId() const
{
return fPublicId;
}
inline const XMLCh* InputSource::getSystemId() const
{
return fSystemId;
}
inline bool InputSource::getIssueFatalErrorIfNotFound() const
{
return fFatalErrorIfNotFound;
}
inline MemoryManager* InputSource::getMemoryManager() const
{
return fMemoryManager;
}
// ---------------------------------------------------------------------------
// InputSource: Setter methods
// ---------------------------------------------------------------------------
inline void InputSource::setIssueFatalErrorIfNotFound(const bool flag)
{
fFatalErrorIfNotFound = flag;
}
XERCES_CPP_NAMESPACE_END
#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
char16_t XMLCh
Definition Xerces_autoconf_config.hpp:120
BinInputStream
Definition BinInputStream.hpp:30
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::XMemory
XMemory()
Protected default constructor.
Definition XMemory.hpp:130