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 * $Id: XMLReaderFactory.hpp 191054 2005-06-17 02:56:35Z jberry $ 00019 */ 00020 00021 #ifndef XMLREADERFACTORY_HPP 00022 #define XMLREADERFACTORY_HPP 00023 00024 #include <xercesc/parsers/SAX2XMLReaderImpl.hpp> 00025 #include <xercesc/sax/SAXException.hpp> 00026 00027 XERCES_CPP_NAMESPACE_BEGIN 00028 00029 class MemoryManager; 00030 class XMLGrammarPool; 00031 00041 class XMLReaderFactory 00042 { 00043 protected: // really should be private, but that causes compiler warnings. 00044 XMLReaderFactory() ; 00045 ~XMLReaderFactory() ; 00046 00047 public: 00048 static SAX2XMLReader * createXMLReader( 00049 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00050 , XMLGrammarPool* const gramPool = 0 00051 ) ; 00052 static SAX2XMLReader * createXMLReader(const XMLCh* className) ; 00053 00054 private: 00055 // ----------------------------------------------------------------------- 00056 // Unimplemented constructors and operators 00057 // ----------------------------------------------------------------------- 00058 XMLReaderFactory(const XMLReaderFactory&); 00059 XMLReaderFactory& operator=(const XMLReaderFactory&); 00060 }; 00061 00062 00063 inline SAX2XMLReader * XMLReaderFactory::createXMLReader(MemoryManager* const manager 00064 , XMLGrammarPool* const gramPool) 00065 { 00066 return (SAX2XMLReader*)(new (manager) SAX2XMLReaderImpl(manager, gramPool)); 00067 } 00068 00069 inline SAX2XMLReader * XMLReaderFactory::createXMLReader(const XMLCh *) 00070 { 00071 throw SAXNotSupportedException(); 00072 // unimplemented 00073 return 0; 00074 } 00075 00076 XERCES_CPP_NAMESPACE_END 00077 00078 #endif