Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

skXMLElementObject.h

00001 /*
00002   Copyright 1996-2002
00003   Simon Whiteside
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019 * $Id: skXMLElementObject.h,v 1.35 2002/12/16 16:11:46 sdw Exp $
00020 */
00021 
00022 
00023 #ifndef skXMLELEMENTOBJECT_H
00024 #define skXMLELEMENTOBJECT_H
00025 
00026 #include "skExecutable.h"
00027 #include <xercesc/dom/deprecated/DOM_Element.hpp>
00028 #include <iostream.h>
00029 #include <xercesc/framework/XMLFormatter.hpp>
00030 
00031 class skMethodTable;
00032 
00033 // this is the value returned by executableType
00034 
00035 #define XMLELEMENT_TYPE 2
00036 
00037 /*
00038  * A stream operator for DOM_Nodes
00039  */
00040 //CLASSEXPORT extern ostream& operator<<(ostream& target, DOM_Node& toWrite);
00041 /*
00042  * A stream operator for DOM_Strings
00043  */
00044 CLASSEXPORT extern ostream& operator<< (ostream& target, const DOMString& s);
00045 
00063 class CLASSEXPORT skXMLElementObject : public skExecutable {
00064  public:
00068   skXMLElementObject();
00074   skXMLElementObject(const skString& location,DOM_Element elem);
00078   ~skXMLElementObject();
00083   int executableType() const;                   
00087   int intValue() const;
00091   float floatValue() const;
00095   bool boolValue() const;
00099   Char charValue() const;
00103   skString strValue() const;
00111   bool setValue(const skString& s,const skString& attribute,const skRValue& return_value);
00119   bool setValueAt(const skRValue& array_index,const skString& attribute,const skRValue& value); 
00129   bool getValue(const skString& s,const skString& attribute,skRValue& return_value);
00134   bool getValueAt(const skRValue& array_index,const skString& attribute,skRValue& value);
00147   bool method(const skString& name,skRValueArray& args,skRValue& ret,skExecutableContext& ctxt);
00152   //  bool equals(skExecutable * o) const;
00157   void copyItemsInto(DOM_Element other);
00161   virtual void setAddIfNotPresent(bool enable);
00165   virtual bool getAddIfNotPresent();
00170   DOM_Element getElement();
00176   static skString getData(DOM_Element element);
00182   static void setData(DOM_Element element,const skString& data);
00189   static DOM_Element findChild(DOM_Element parent,const skString& tagname);
00196   static DOM_Element findChild(DOM_Element parent,int index);
00205   static DOM_Element findChild(DOM_Element parent,const skString& tagname,const skString& attribute,const skString& value);
00209   void setAttribute(skString name,const skString& value);
00214   skString getAttribute(const skString& name);
00218   static skString toString(DOMString str);
00222   static DOMString fromString(const skString& str);
00226   skString getLocation() const;
00228   static int countChildren(DOM_Element parent);
00233   void save(ostream& out);
00234  protected:
00239   virtual void setElement(DOM_Element element);
00245   virtual skXMLElementObject * createXMLElementObject(const skString& location,DOM_Element element);
00249   skString m_ScriptLocation;
00254   skExecutableIterator * createIterator(const skString& qualifier);
00258   skExecutableIterator * createIterator();
00259  private:
00263   DOM_Element m_Element;
00267   skMethodTable * m_MethodCache;
00271   skXMLElementObject(const skXMLElementObject&);
00275   skXMLElementObject& operator=(const skXMLElementObject&);
00277   void save(ostream& target, DOM_Node& toWrite,XMLFormatter& formatter,XMLCh* encoding_name);
00282   bool m_AddIfNotPresent;
00283 
00284 };
00285 
00286 #endif

Generated on Mon Dec 16 16:30:12 2002 for Simkin by doxygen1.3-rc1