00001 // rdObject.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 __rdObject_h__ 00010 #define __rdObject_h__ 00011 00012 00013 // INCLUDES 00014 #include "rdTools.h" 00015 #include "rdXMLNode.h" 00016 #include "rdXMLDocument.h" 00017 00018 00019 // CONSTANTS 00020 const int rdObject_NAME_LENGTH = 128; 00021 00022 00023 //============================================================================= 00024 //============================================================================= 00035 class RDTOOLS_API rdObject 00036 { 00037 00038 //============================================================================= 00039 // DATA 00040 //============================================================================= 00041 public: 00043 static const int NAME_LENGTH; 00045 static const char PROP_NAME[]; 00046 private: 00048 char *_type; 00050 char *_name; 00051 protected: 00053 rdXMLDocument *_document; 00055 IDOM_Element *_node; 00056 00057 //============================================================================= 00058 // METHODS 00059 //============================================================================= 00060 //-------------------------------------------------------------------------- 00061 // CONSTRUCTION 00062 //-------------------------------------------------------------------------- 00063 public: 00064 rdObject(); 00065 rdObject(const char *aFileName); 00066 rdObject(const rdXMLDocument *aDocument); 00067 rdObject(IDOM_Element *aNode); 00068 rdObject(const rdObject &aObject); 00069 virtual ~rdObject(); 00070 private: 00071 void setNull(); 00072 00073 //-------------------------------------------------------------------------- 00074 // OPERATORS 00075 //-------------------------------------------------------------------------- 00076 public: 00077 rdObject& operator=(const rdObject &aObject); 00078 virtual bool operator==(const rdObject &aObject); 00079 00080 //-------------------------------------------------------------------------- 00081 // GET AND SET 00082 //-------------------------------------------------------------------------- 00083 protected: 00084 void setType(const char *aType); 00085 public: 00086 const char* getType() const; 00087 void setName(const char *aName); 00088 const char* getName() const; 00089 rdXMLDocument* getDocument() const; 00090 IDOM_Element* getNode() const; 00091 00092 //-------------------------------------------------------------------------- 00093 // XML 00094 //-------------------------------------------------------------------------- 00095 virtual void updateObject(bool aDeep=true); 00096 virtual void updateNode(bool aDeep=true); 00097 virtual void generateNode(IDOM_Element *aParent); 00098 private: 00099 void generateDocument(); 00100 00101 //-------------------------------------------------------------------------- 00102 // IO 00103 //-------------------------------------------------------------------------- 00104 public: 00105 void print(const char *aFileName=NULL); 00106 00107 //============================================================================= 00108 }; // END of class rdObject 00109 //============================================================================= 00110 //============================================================================= 00111 00112 #endif //__rdObject_h__
1.3