00001 /***************************** License ********************************** 00002 00003 Copyright (C) 2008 by Communicative Machines 00004 http://www.cmlabs.com All rights reserved. 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation; either 00009 version 2.1 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public 00017 License along with this library; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 00020 ************************************************************************/ 00021 // UninstantiatedXMLObject.cpp: implementation of the UninstantiatedXMLObject class. 00022 // 00023 ////////////////////////////////////////////////////////////////////// 00024 00025 #include "UninstantiatedXMLObject.h" 00026 00027 namespace cmlabs { 00028 00029 ////////////////////////////////////////////////////////////////////// 00030 // Construction/Destruction 00031 ////////////////////////////////////////////////////////////////////// 00032 00033 UninstantiatedXMLObject::UninstantiatedXMLObject(JString xmlString) 00034 { 00035 xml = xmlString; 00036 } 00037 00038 UninstantiatedXMLObject::UninstantiatedXMLObject(XMLNode* node) 00039 { 00040 // xml = node->getTextContent(); 00041 xml = node->asXML(); 00042 } 00043 00044 UninstantiatedXMLObject::~UninstantiatedXMLObject() 00045 { 00046 } 00047 00048 //! Get total size of payload 00049 unsigned long UninstantiatedXMLObject::getPayloadSize() const { 00050 return xml.getPayloadSize(); 00051 } 00052 00053 Object* UninstantiatedXMLObject::clone() const 00054 { 00055 UninstantiatedXMLObject* obj = new UninstantiatedXMLObject(xml); 00056 return obj; 00057 } 00058 00059 bool UninstantiatedXMLObject::setXML(JString xmlString) 00060 { 00061 xml = xmlString; 00062 return true; 00063 } 00064 00065 JString UninstantiatedXMLObject::getXML() 00066 { 00067 return xml; 00068 } 00069 00070 JString UninstantiatedXMLObject::print() { 00071 return JString::format("Raw unparsed XML: %d bytes", xml.length()); 00072 } 00073 00074 JString UninstantiatedXMLObject::toXML() { 00075 return xml; 00076 } 00077 00078 bool UninstantiatedXMLObject::fromXML(const JString& xmlString) { 00079 xml = xmlString; 00080 return true; 00081 } 00082 00083 bool UninstantiatedXMLObject::fromXML(XMLNode* node) { 00084 xml = node->getTextContent(); 00085 return true; 00086 } 00087 00088 JString UninstantiatedXMLObject::getClass() { 00089 return "UninstantiatedXMLObject"; 00090 } 00091 00092 00093 00094 00095 } // namespace cmlabs