00001 #ifndef _REFOBJ_IO_H_
00002 #define _REFOBJ_IO_H_
00003
00004 #include <iostream>
00005 #include <string>
00006
00007 namespace ObjCryst
00008 {
00009 class XMLCrystTag;
00010 }
00011 #ifdef __WX__CRYST__
00012 #include "wxCryst/wxCryst.h"
00013 #endif
00014
00015 namespace ObjCryst
00016 {
00017 #ifdef __WX__CRYST__
00018
00022 class WXXMLCrystTag: public WXCrystObj
00023 {
00024 public:
00025 WXXMLCrystTag(wxWindow *parent, XMLCrystTag*);
00026 virtual void CrystUpdate();
00027 virtual void SetObjName(const string&);
00028 virtual string GetObjName()const;
00029 virtual bool Show(const bool);
00030 private:
00031 XMLCrystTag* mpTag;
00032 };
00033 #endif
00034
00037 class XMLCrystTag
00038 {
00039 public:
00040 XMLCrystTag();
00041 XMLCrystTag(istream &is);
00042 XMLCrystTag(const string &tagName,const bool isEndTag=false, const bool isEmptyTag=false);
00043 ~XMLCrystTag();
00044 const string& GetName()const;
00045 const string& GetClassName()const;
00046 unsigned int GetNbAttribute()const;
00047 void AddAttribute(const string &attName,const string &attValue);
00048 void GetAttribute(const int attNum,string &attName,string &attValue);
00049 const string& GetAttributeName(const int attNum)const;
00050 const string& GetAttributeValue(const int attNum)const;
00051 void SetIsEndTag(const bool isEndTag);
00052 bool IsEndTag()const;
00053 void SetIsEmptyTag(const bool isEmptyTag);
00054 bool IsEmptyTag()const;
00055 void Print()const;
00056 private:
00057 string mName;
00058 bool mIsEndTag;
00059 bool mIsEmptyTag;
00060 unsigned int mNbAttribute;
00061 string mAttributeName [20];
00062 string mAttributeValue[20];
00063 friend ostream& operator<< (ostream&, const XMLCrystTag&);
00064 friend istream& operator>> (istream&, XMLCrystTag&);
00065 #ifdef __WX__CRYST__
00066 public:
00068 WXCrystObj* WXCreate(wxWindow*);
00069 WXCrystObj* WXGet();
00070 void WXDelete();
00071 void WXNotifyDelete();
00072 protected:
00073 WXXMLCrystTag *mpWXXMLCrystTag;
00074 #endif
00075 };
00076
00078 ostream& operator<< (ostream&, const XMLCrystTag&);
00080 istream& operator>> (istream&, XMLCrystTag&);
00081
00082 #if 0
00083
00084
00085 void IOCrystExtractNameSpace(istream &is,string &str);
00086 void IOCrystExtractNameLine(istream &is,string &str);
00087 void IOCrystExtractNameQuoted(istream &is,string &str);
00088 void IOCrystXMLOutputNameQuoted(ostream &os,const string &str);
00089
00090 #ifdef __WX__CRYST__
00091 class IOCrystTag;
00092
00093 class WXIOCrystTag: public WXCrystObj
00094 {
00095 public:
00096 WXIOCrystTag(wxWindow *parent, IOCrystTag*);
00097 virtual void CrystUpdate();
00098 virtual void SetObjName(const string&);
00099 virtual string GetObjName()const;
00100 virtual bool Show(const bool);
00101 private:
00102 IOCrystTag* mpTag;
00103 };
00104 #endif
00109 class IOCrystTag
00110 {
00111 public:
00112 IOCrystTag(const string& type,const string& name, const unsigned long version=0);
00113 IOCrystTag(istream &is);
00114 virtual ~IOCrystTag();
00115 void XMLInput(istream &is);
00116 bool operator==(const IOCrystTag&)const;
00117 const string &GetType()const;
00118 const string &GetName()const;
00119 unsigned long GetVersion()const;
00120 bool IsClosingTag()const;
00121 void Print()const;
00123 const string &GetClassName()const;
00124 private:
00125 string mTagType;
00126 string mTagName;
00127 unsigned long mTagVersion;
00128 bool mIsClosingTag;
00129 #ifdef __WX__CRYST__
00130 public:
00132 virtual WXCrystObj* WXCreate(wxWindow*);
00133 WXCrystObj* WXGet();
00134 void WXDelete();
00135 void WXNotifyDelete();
00136 protected:
00137 WXIOCrystTag *mpWXIOCrystTag;
00138 #endif
00139 };
00140 #endif
00141
00142 }
00143
00144 #endif //_REFOBJ_IO_H_