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 568078 2007-08-21 11:43:25Z amassari $ 00020 */ 00021 00022 00023 #ifndef INPUTSOURCE_HPP 00024 #define INPUTSOURCE_HPP 00025 00026 #include <xercesc/util/PlatformUtils.hpp> 00027 00028 XERCES_CPP_NAMESPACE_BEGIN 00029 00030 class BinInputStream; 00031 00032 00063 class InputSource : public XMemory 00064 { 00065 public: 00066 // ----------------------------------------------------------------------- 00067 // All constructors are hidden, just the destructor is available 00068 // ----------------------------------------------------------------------- 00075 virtual ~InputSource(); 00077 00078 00079 // ----------------------------------------------------------------------- 00092 virtual BinInputStream* makeStream() const = 0; 00093 00095 00096 00097 // ----------------------------------------------------------------------- 00109 virtual const XMLCh* getEncoding() const; 00110 00111 00118 virtual const XMLCh* getPublicId() const; 00119 00120 00129 virtual const XMLCh* getSystemId() const; 00130 00139 virtual bool getIssueFatalErrorIfNotFound() const; 00140 00141 MemoryManager* getMemoryManager() const; 00142 00144 00145 00146 // ----------------------------------------------------------------------- 00149 00161 virtual void setEncoding(const XMLCh* const encodingStr); 00162 00163 00175 virtual void setPublicId(const XMLCh* const publicId); 00176 00193 virtual void setSystemId(const XMLCh* const systemId); 00194 00204 virtual void setIssueFatalErrorIfNotFound(const bool flag); 00205 00207 00208 00209 protected : 00210 // ----------------------------------------------------------------------- 00211 // Hidden constructors 00212 // ----------------------------------------------------------------------- 00216 InputSource(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); 00217 00223 InputSource(const XMLCh* const systemId, 00224 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); 00225 00232 InputSource 00233 ( 00234 const XMLCh* const systemId 00235 , const XMLCh* const publicId 00236 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00237 ); 00238 00244 InputSource(const char* const systemId, 00245 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); 00246 00253 InputSource 00254 ( 00255 const char* const systemId 00256 , const char* const publicId 00257 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00258 ); 00259 00261 00262 00263 00264 00265 00266 private: 00267 // ----------------------------------------------------------------------- 00268 // Unimplemented constructors and operators 00269 // ----------------------------------------------------------------------- 00270 InputSource(const InputSource&); 00271 InputSource& operator=(const InputSource&); 00272 00273 00274 // ----------------------------------------------------------------------- 00275 // Private data members 00276 // 00277 // fEncoding 00278 // This is the encoding to use. Usually this is null, which means 00279 // to use the information found in the file itself. But, if set, 00280 // this encoding will be used without question. 00281 // 00282 // fPublicId 00283 // This is the optional public id for the input source. It can be 00284 // null if none is desired. 00285 // 00286 // fSystemId 00287 // This is the system id for the input source. This is what is 00288 // actually used to open the source. 00289 // 00290 // fFatalErrorIfNotFound 00291 // ----------------------------------------------------------------------- 00292 MemoryManager* const fMemoryManager; 00293 XMLCh* fEncoding; 00294 XMLCh* fPublicId; 00295 XMLCh* fSystemId; 00296 bool fFatalErrorIfNotFound; 00297 }; 00298 00299 00300 // --------------------------------------------------------------------------- 00301 // InputSource: Getter methods 00302 // --------------------------------------------------------------------------- 00303 inline const XMLCh* InputSource::getEncoding() const 00304 { 00305 return fEncoding; 00306 } 00307 00308 inline const XMLCh* InputSource::getPublicId() const 00309 { 00310 return fPublicId; 00311 } 00312 00313 inline const XMLCh* InputSource::getSystemId() const 00314 { 00315 return fSystemId; 00316 } 00317 00318 inline bool InputSource::getIssueFatalErrorIfNotFound() const 00319 { 00320 return fFatalErrorIfNotFound; 00321 } 00322 00323 inline MemoryManager* InputSource::getMemoryManager() const 00324 { 00325 return fMemoryManager; 00326 } 00327 00328 // --------------------------------------------------------------------------- 00329 // InputSource: Setter methods 00330 // --------------------------------------------------------------------------- 00331 inline void InputSource::setIssueFatalErrorIfNotFound(const bool flag) 00332 { 00333 fFatalErrorIfNotFound = flag; 00334 } 00335 00336 XERCES_CPP_NAMESPACE_END 00337 00338 #endif