- Main Page
- Related Pages
- Classes
- Files

# InputSource.hpp

Go to the documentation of this file.

    00001 /*
    00002  * Licensed to the Apache Software Foundation (ASF) under one or more
    00003  * contributor license agreements.  See the NOTICE file distributed with
    00004  * this work for additional information regarding copyright ownership.
    00005  * The ASF licenses this file to You under the Apache License, Version 2.0
    00006  * (the "License"); you may not use this file except in compliance with
    00007  * the License.  You may obtain a copy of the License at
    00008  *
    00009  *      http://www.apache.org/licenses/LICENSE-2.0
    00010  *
    00011  * Unless required by applicable law or agreed to in writing, software
    00012  * distributed under the License is distributed on an "AS IS" BASIS,
    00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00014  * See the License for the specific language governing permissions and
    00015  * limitations under the License.
    00016  */
    00017
    00018 /*
    00019  * $Id: InputSource.hpp 932887 2010-04-11 13:04:59Z borisk $
    00020  */
    00021
    00022 #if !defined(XERCESC_INCLUDE_GUARD_INPUTSOURCE_HPP)
    00023 #define XERCESC_INCLUDE_GUARD_INPUTSOURCE_HPP
    00024
    00025 #include <xercesc/util/PlatformUtils.hpp>
    00026
    00027 XERCES_CPP_NAMESPACE_BEGIN
    00028
    00029 class BinInputStream;
    00030
    00031
    00062 class SAX_EXPORT InputSource : public XMemory
    00063 {
    00064 public:
    00065     // -----------------------------------------------------------------------
    00066     //  All constructors are hidden, just the destructor is available
    00067     // -----------------------------------------------------------------------
    00074     virtual ~InputSource();
    00076
    00077
    00078     // -----------------------------------------------------------------------
    00091     virtual BinInputStream* makeStream() const = 0;
    00092
    00094
    00095
    00096     // -----------------------------------------------------------------------
    00108     virtual const XMLCh* getEncoding() const;
    00109
    00110
    00117     virtual const XMLCh* getPublicId() const;
    00118
    00119
    00128     virtual const XMLCh* getSystemId() const;
    00129
    00138     virtual bool getIssueFatalErrorIfNotFound() const;
    00139
    00140     MemoryManager* getMemoryManager() const;
    00141
    00143
    00144
    00145     // -----------------------------------------------------------------------
    00148
    00160     virtual void setEncoding(const XMLCh* const encodingStr);
    00161
    00162
    00174     virtual void setPublicId(const XMLCh* const publicId);
    00175
    00192     virtual void setSystemId(const XMLCh* const systemId);
    00193
    00203     virtual void setIssueFatalErrorIfNotFound(const bool flag);
    00204
    00206
    00207
    00208 protected :
    00209     // -----------------------------------------------------------------------
    00210     //  Hidden constructors
    00211     // -----------------------------------------------------------------------
    00215     InputSource(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
    00216
    00222     InputSource(const XMLCh* const systemId,
    00223                 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
    00224
    00231     InputSource
    00232     (
    00233         const   XMLCh* const   systemId
    00234         , const XMLCh* const   publicId
    00235         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
    00236     );
    00237
    00243     InputSource(const char* const systemId,
    00244                 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
    00245
    00252     InputSource
    00253     (
    00254         const   char* const systemId
    00255         , const char* const publicId
    00256         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
    00257     );
    00258
    00260
    00261
    00262
    00263
    00264
    00265 private:
    00266     // -----------------------------------------------------------------------
    00267     //  Unimplemented constructors and operators
    00268     // -----------------------------------------------------------------------
    00269     InputSource(const InputSource&);
    00270     InputSource& operator=(const InputSource&);
    00271
    00272
    00273     // -----------------------------------------------------------------------
    00274     //  Private data members
    00275     //
    00276     //  fEncoding
    00277     //      This is the encoding to use. Usually this is null, which means
    00278     //      to use the information found in the file itself. But, if set,
    00279     //      this encoding will be used without question.
    00280     //
    00281     //  fPublicId
    00282     //      This is the optional public id for the input source. It can be
    00283     //      null if none is desired.
    00284     //
    00285     //  fSystemId
    00286     //      This is the system id for the input source. This is what is
    00287     //      actually used to open the source.
    00288     //
    00289     //  fFatalErrorIfNotFound
    00290     // -----------------------------------------------------------------------
    00291     MemoryManager* const fMemoryManager;
    00292     XMLCh*         fEncoding;
    00293     XMLCh*         fPublicId;
    00294     XMLCh*         fSystemId;
    00295     bool           fFatalErrorIfNotFound;
    00296 };
    00297
    00298
    00299 // ---------------------------------------------------------------------------
    00300 //  InputSource: Getter methods
    00301 // ---------------------------------------------------------------------------
    00302 inline const XMLCh* InputSource::getEncoding() const
    00303 {
    00304     return fEncoding;
    00305 }
    00306
    00307 inline const XMLCh* InputSource::getPublicId() const
    00308 {
    00309     return fPublicId;
    00310 }
    00311
    00312 inline const XMLCh* InputSource::getSystemId() const
    00313 {
    00314     return fSystemId;
    00315 }
    00316
    00317 inline bool InputSource::getIssueFatalErrorIfNotFound() const
    00318 {
    00319     return fFatalErrorIfNotFound;
    00320 }
    00321
    00322 inline MemoryManager* InputSource::getMemoryManager() const
    00323 {
    00324     return fMemoryManager;
    00325 }
    00326
    00327 // ---------------------------------------------------------------------------
    00328 //  InputSource: Setter methods
    00329 // ---------------------------------------------------------------------------
    00330 inline void InputSource::setIssueFatalErrorIfNotFound(const bool flag)
    00331 {
    00332     fFatalErrorIfNotFound = flag;
    00333 }
    00334
    00335 XERCES_CPP_NAMESPACE_END
    00336
    00337 #endif