00001 /* 00002 * Copyright 1999-2000,2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 /* 00018 * $Log: InputSource.hpp,v $ 00019 * Revision 1.12 2004/09/08 13:56:19 peiyongz 00020 * Apache License Version 2.0 00021 * 00022 * Revision 1.11 2003/12/17 00:18:35 cargilld 00023 * Update to memory management so that the static memory manager (one used to call Initialize) is only for static data. 00024 * 00025 * Revision 1.10 2003/12/01 23:23:26 neilg 00026 * fix for bug 25118; thanks to Jeroen Witmond 00027 * 00028 * Revision 1.9 2003/11/17 10:52:15 amassari 00029 * Fixed documentation bug#24746 00030 * 00031 * Revision 1.8 2003/05/30 16:11:45 gareth 00032 * Fixes so we compile under VC7.1. Patch by Alberto Massari. 00033 * 00034 * Revision 1.7 2003/05/16 21:36:59 knoaman 00035 * Memory manager implementation: Modify constructors to pass in the memory manager. 00036 * 00037 * Revision 1.6 2003/05/15 18:27:05 knoaman 00038 * Partial implementation of the configurable memory manager. 00039 * 00040 * Revision 1.5 2003/03/07 18:10:06 tng 00041 * Return a reference instead of void for operator= 00042 * 00043 * Revision 1.4 2002/11/04 14:56:26 tng 00044 * C++ Namespace Support. 00045 * 00046 * Revision 1.3 2002/09/30 18:26:18 tng 00047 * Since the derived class Wrapper4DOMInputSource has overwritten the set/getEncoding, SystemId, PublicId ... etc., these functions has to be virtual for them to work. 00048 * 00049 * Revision 1.2 2002/02/20 18:17:01 tng 00050 * [Bug 5977] Warnings on generating apiDocs. 00051 * 00052 * Revision 1.1.1.1 2002/02/01 22:22:08 peiyongz 00053 * sane_include 00054 * 00055 * Revision 1.10 2001/11/21 16:14:32 tng 00056 * Schema: New method InputSource::get/setIssueFatalErrorIfNotFound to tell the parser whether to issue fatal error or not if cannot find it (the InputSource). This is required for schema processing as it shouldn't be a fatal error if the schema is not found. 00057 * 00058 * Revision 1.9 2000/03/02 19:54:35 roddey 00059 * This checkin includes many changes done while waiting for the 00060 * 1.1.0 code to be finished. I can't list them all here, but a list is 00061 * available elsewhere. 00062 * 00063 * Revision 1.8 2000/02/24 20:12:55 abagchi 00064 * Swat for removing Log from API docs 00065 * 00066 * Revision 1.7 2000/02/12 03:42:21 rahulj 00067 * Fixed DOC++ documentation formatting errors. 00068 * 00069 * Revision 1.6 2000/02/12 03:31:55 rahulj 00070 * Removed duplicate CVS Log entries. 00071 * 00072 * Revision 1.5 2000/02/12 01:27:19 aruna1 00073 * Documentation updated 00074 * 00075 * Revision 1.4 2000/02/09 02:15:28 abagchi 00076 * Documented destructor 00077 * 00078 * Revision 1.3 2000/02/06 07:47:58 rahulj 00079 * Year 2K copyright swat. 00080 * 00081 * Revision 1.2 2000/01/12 00:15:39 roddey 00082 * Changes to deal with multiply nested, relative pathed, entities and to deal 00083 * with the new URL class changes. 00084 * 00085 * Revision 1.1.1.1 1999/11/09 01:07:46 twl 00086 * Initial checkin 00087 * 00088 * Revision 1.2 1999/11/08 20:45:01 rahul 00089 * Swat for adding in Product name and CVS comment log variable. 00090 * 00091 */ 00092 00093 00094 #ifndef INPUTSOURCE_HPP 00095 #define INPUTSOURCE_HPP 00096 00097 #include <xercesc/util/PlatformUtils.hpp> 00098 00099 XERCES_CPP_NAMESPACE_BEGIN 00100 00101 class BinInputStream; 00102 00103 00134 class InputSource : public XMemory 00135 { 00136 public: 00137 // ----------------------------------------------------------------------- 00138 // All constructors are hidden, just the destructor is available 00139 // ----------------------------------------------------------------------- 00146 virtual ~InputSource(); 00148 00149 00150 // ----------------------------------------------------------------------- 00163 virtual BinInputStream* makeStream() const = 0; 00164 00166 00167 00168 // ----------------------------------------------------------------------- 00180 virtual const XMLCh* getEncoding() const; 00181 00182 00189 virtual const XMLCh* getPublicId() const; 00190 00191 00200 virtual const XMLCh* getSystemId() const; 00201 00210 virtual bool getIssueFatalErrorIfNotFound() const; 00211 00212 MemoryManager* getMemoryManager() const; 00213 00215 00216 00217 // ----------------------------------------------------------------------- 00220 00232 virtual void setEncoding(const XMLCh* const encodingStr); 00233 00234 00246 virtual void setPublicId(const XMLCh* const publicId); 00247 00264 virtual void setSystemId(const XMLCh* const systemId); 00265 00275 virtual void setIssueFatalErrorIfNotFound(const bool flag); 00276 00278 00279 00280 protected : 00281 // ----------------------------------------------------------------------- 00282 // Hidden constructors 00283 // ----------------------------------------------------------------------- 00287 InputSource(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); 00288 00294 InputSource(const XMLCh* const systemId, 00295 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); 00296 00303 InputSource 00304 ( 00305 const XMLCh* const systemId 00306 , const XMLCh* const publicId 00307 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00308 ); 00309 00315 InputSource(const char* const systemId, 00316 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); 00317 00324 InputSource 00325 ( 00326 const char* const systemId 00327 , const char* const publicId 00328 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00329 ); 00330 00332 00333 00334 00335 00336 00337 private: 00338 // ----------------------------------------------------------------------- 00339 // Unimplemented constructors and operators 00340 // ----------------------------------------------------------------------- 00341 InputSource(const InputSource&); 00342 InputSource& operator=(const InputSource&); 00343 00344 00345 // ----------------------------------------------------------------------- 00346 // Private data members 00347 // 00348 // fEncoding 00349 // This is the encoding to use. Usually this is null, which means 00350 // to use the information found in the file itself. But, if set, 00351 // this encoding will be used without question. 00352 // 00353 // fPublicId 00354 // This is the optional public id for the input source. It can be 00355 // null if none is desired. 00356 // 00357 // fSystemId 00358 // This is the system id for the input source. This is what is 00359 // actually used to open the source. 00360 // 00361 // fFatalErrorIfNotFound 00362 // ----------------------------------------------------------------------- 00363 MemoryManager* const fMemoryManager; 00364 XMLCh* fEncoding; 00365 XMLCh* fPublicId; 00366 XMLCh* fSystemId; 00367 bool fFatalErrorIfNotFound; 00368 }; 00369 00370 00371 // --------------------------------------------------------------------------- 00372 // InputSource: Getter methods 00373 // --------------------------------------------------------------------------- 00374 inline const XMLCh* InputSource::getEncoding() const 00375 { 00376 return fEncoding; 00377 } 00378 00379 inline const XMLCh* InputSource::getPublicId() const 00380 { 00381 return fPublicId; 00382 } 00383 00384 inline const XMLCh* InputSource::getSystemId() const 00385 { 00386 return fSystemId; 00387 } 00388 00389 inline bool InputSource::getIssueFatalErrorIfNotFound() const 00390 { 00391 return fFatalErrorIfNotFound; 00392 } 00393 00394 inline MemoryManager* InputSource::getMemoryManager() const 00395 { 00396 return fMemoryManager; 00397 } 00398 00399 // --------------------------------------------------------------------------- 00400 // InputSource: Setter methods 00401 // --------------------------------------------------------------------------- 00402 inline void InputSource::setIssueFatalErrorIfNotFound(const bool flag) 00403 { 00404 fFatalErrorIfNotFound = flag; 00405 } 00406 00407 XERCES_CPP_NAMESPACE_END 00408 00409 #endif