00001 // rdXMLNode.h 00002 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00003 // Copyright 2002 Realistic Dynamics, Inc. 00004 // All rights reserved. 00005 // 00006 // Please do not read, copy, distribute, or use without permission. 00007 // Contact: Frank C. Anderson, fca@RealisticDynamics.com 00008 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00009 #ifndef __rdXMLNode_h__ 00010 #define __rdXMLNode_h__ 00011 00012 00013 // INCLUDES 00014 #include <xercesc/idom/IDOM.hpp> 00015 #include "rdTools.h" 00016 #include "rdObject.h" 00017 00018 00019 //============================================================================= 00020 //============================================================================= 00033 class RDTOOLS_API rdXMLNode { 00034 //============================================================================= 00035 // DATA 00036 //============================================================================= 00037 static const int TABLIMIT; 00038 00039 //============================================================================= 00040 // METHODS 00041 //============================================================================= 00042 //-------------------------------------------------------------------------- 00043 // CONSTRUCTION AND DESTRUCTION 00044 //-------------------------------------------------------------------------- 00045 public: 00046 00047 //-------------------------------------------------------------------------- 00048 // UTILITY 00049 //-------------------------------------------------------------------------- 00050 static int GetNumberOfParents(const IDOM_Node *node); 00051 00052 //-------------------------------------------------------------------------- 00053 // ADD NODES 00054 //-------------------------------------------------------------------------- 00055 static IDOM_Element* 00056 AppendNewElement(IDOM_Node *node,const char *aTag,const char *aName=NULL); 00057 00058 //-------------------------------------------------------------------------- 00059 // GET NODES 00060 //-------------------------------------------------------------------------- 00061 static IDOM_Element* 00062 GetFirstChildElementByTagName(const IDOM_Node *aNode, 00063 const char *aTagName); 00064 static IDOM_CharacterData* 00065 GetCDataSectionNode(const IDOM_Node *aNode); 00066 static IDOM_Text* 00067 GetTextNode(const IDOM_Node *aNode); 00068 00069 //-------------------------------------------------------------------------- 00070 // FUNDAMENTAL VALUE TYPES 00071 //-------------------------------------------------------------------------- 00072 static bool 00073 GetBool(const IDOM_Node *aNode); 00074 static int 00075 GetInt(const IDOM_Node *aNode); 00076 static double 00077 GetDbl(const IDOM_Node *aNode); 00078 static char* 00079 GetStr(const IDOM_Node *aNode); 00080 00081 //-------------------------------------------------------------------------- 00082 // FUNDAMENTAL ARRAY TYPES 00083 //-------------------------------------------------------------------------- 00084 // BOOL ARRAY 00085 static void 00086 SetBoolArray(IDOM_Node *aNode,int aN,const bool *aData); 00087 static int 00088 GetBoolArray(const IDOM_Node *aNode,bool *&rData); 00089 // INT ARRAY 00090 static void 00091 SetIntArray(IDOM_Node *aNode,int aN,const int *aData); 00092 static int 00093 GetIntArray(const IDOM_Node *aNode,int *&rData); 00094 // DOUBLE ARRAY 00095 static void 00096 SetDblArray(IDOM_Node *aNode,int aN,const double *aData); 00097 static int 00098 GetDblArray(const IDOM_Node *aNode,double *&rData); 00099 // STRING ARRAY 00100 static void 00101 SetStrArray(IDOM_Node *aNode,int aN,char **rData); 00102 static int 00103 GetStrArray(const IDOM_Node *aNode,char **&rData); 00104 00105 //-------------------------------------------------------------------------- 00106 // ELEMENT ATTRIBUTES 00107 //-------------------------------------------------------------------------- 00108 static void 00109 SetAttribute(IDOM_Node *aNode,const char *aName,const char *aValue); 00110 static char* 00111 GetAttribute(IDOM_Node *aNode,const char *aName); 00112 00113 00114 //============================================================================= 00115 }; // END CLASS rdXMLNode 00116 //============================================================================= 00117 //============================================================================= 00118 00119 #endif // __rdXMLNode_h__
1.3