00001 /************************************************************************** 00002 ulxr_xmlparse_base.cpp - parse xml files 00003 ------------------- 00004 begin : Fri Jan 09 2004 00005 copyright : (C) 2002-2007 by Ewald Arnold 00006 email : ulxmlrpcpp@ewald-arnold.de 00007 00008 $Id: ulxr_xmlparse_base.cpp 940 2006-12-30 18:22:05Z ewald-arnold $ 00009 00010 ***************************************************************************/ 00011 00012 /************************************************************************** 00013 * 00014 * This program is free software; you can redistribute it and/or modify 00015 * it under the terms of the GNU Lesser General Public License as 00016 * published by the Free Software Foundation; either version 2 of the License, 00017 * or (at your option) any later version. 00018 * 00019 * This program is distributed in the hope that it will be useful, 00020 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 * GNU General Public License for more details. 00023 * 00024 * You should have received a copy of the GNU Lesser General Public License 00025 * along with this program; if not, write to the Free Software 00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00027 * 00028 ***************************************************************************/ 00029 00030 #define ULXR_NEED_EXPORTS 00031 #include <ulxmlrpcpp/ulxmlrpcpp.h> 00032 00033 #include <ulxmlrpcpp/ulxr_xmlparse_base.h> 00034 00035 00036 namespace ulxr { 00037 00038 00039 ULXR_API_IMPL0 XmlParserBase::XmlParserBase() 00040 { 00041 ULXR_TRACE(ULXR_PCHAR("XmlParserBase::XmlParserBase()")); 00042 complete = false; 00043 } 00044 00045 00046 ULXR_API_IMPL0 XmlParserBase::~XmlParserBase() 00047 { 00048 } 00049 00050 00051 ULXR_API_IMPL(void) XmlParserBase::clearStates() 00052 { 00053 while (!states.empty()) 00054 { 00055 delete states.top(); 00056 states.pop(); 00057 } 00058 } 00059 00060 ULXR_API_IMPL(bool) XmlParserBase::isComplete() const 00061 { 00062 return complete; 00063 } 00064 00065 00066 ULXR_API_IMPL(void) XmlParserBase::setComplete(bool comp) 00067 { 00068 complete = comp; 00069 } 00070 00071 00073 // 00074 00075 ULXR_API_IMPL0 XmlParserBase::ParserState::ParserState (unsigned st) 00076 : state(st) 00077 , prevstate(eUnknown) 00078 { 00079 } 00080 00081 00082 ULXR_API_IMPL0 XmlParserBase::ParserState::~ParserState() 00083 { 00084 } 00085 00086 00087 ULXR_API_IMPL(unsigned) XmlParserBase::ParserState::getParserState() const 00088 { 00089 return state; 00090 } 00091 00092 00093 ULXR_API_IMPL(unsigned) XmlParserBase::ParserState::getPrevParserState() const 00094 { 00095 return prevstate; 00096 } 00097 00098 00099 ULXR_API_IMPL(void) XmlParserBase::ParserState::setPrevParserState(unsigned prev) 00100 { 00101 prevstate = prev; 00102 } 00103 00104 00105 ULXR_API_IMPL(CppString) XmlParserBase::ParserState::getStateName() const 00106 { 00107 return ULXR_PCHAR("eUnknown"); 00108 } 00109 00110 00111 ULXR_API_IMPL(void) XmlParserBase::ParserState::appendCharData(const std::string &/*s*/) 00112 { 00113 ULXR_TRACE(ULXR_PCHAR("XmlParserBase::ParserState::appendCharData(const std::string &)")); 00114 #ifdef ULXR_UNICODE 00115 #else 00116 #endif 00117 } 00118 00119 00120 ULXR_API_IMPL(void) XmlParserBase::ParserState::appendCharData(const XML_Char *s, int len) 00121 { 00122 ULXR_TRACE(ULXR_PCHAR("XmlParserBase::ParserState::appendCharData(const XML_Char *, int)")); 00123 #ifdef ULXR_UNICODE 00124 cdata += utf8ToUnicode(Cpp8BitString(s, len)); 00125 #else 00126 cdata.append(s, len); 00127 #endif 00128 } 00129 00130 00131 ULXR_API_IMPL(CppString) XmlParserBase::ParserState::getCharData() const 00132 { 00133 ULXR_TRACE(ULXR_PCHAR("XmlParserBase::ParserState::getCharData()")); 00134 return cdata; 00135 } 00136 00137 00138 } // namespace ulxr 00139