00001 00006 /*----------------------------------------------------------------------------*/ 00007 /* C Tool Box: Designed and implemented by: */ 00008 /* Walter F.J. Mueller Gesellschaft fuer Schwerionenforschung (GSI) */ 00009 /* Planckstrasse 1, D-64291 Darmstadt, Germany */ 00010 /* Email: W.F.J.Mueller@gsi.de */ 00011 /* WWW: http://www-kp3.gsi.de/www/kp3/people/mueller.html */ 00012 /*----------------------------------------------------------------------------*/ 00013 00014 //------------------------------------------+----------------------------------- 00015 #ifdef DEV_DOCS 00016 00017 #endif 00018 00019 inline ostream* CTBxmlOStream::Stream() const 00020 { 00021 return mp_os; 00022 } 00023 00024 //------------------------------------------+----------------------------------- 00025 #ifdef DEV_DOCS 00026 00027 #endif 00028 00029 inline void CTBxmlOStream::SetBad() 00030 { 00031 mb_bad = true; 00032 mb_fail = true; 00033 return; 00034 } 00035 00036 //------------------------------------------+----------------------------------- 00037 #ifdef DEV_DOCS 00038 00039 #endif 00040 00041 inline void CTBxmlOStream::SetFail() 00042 { 00043 mb_fail = true; 00044 return; 00045 } 00046 00047 //------------------------------------------+----------------------------------- 00049 00050 inline bool CTBxmlOStream::operator!() const 00051 { 00052 return Fail(); 00053 } 00054 00055 //------------------------------------------+----------------------------------- 00057 00058 inline CTBxmlOStream::operator void* () const 00059 { 00060 return (!Fail()) ? (void*) this : 0; 00061 } 00062 00063 //------------------------------------------+----------------------------------- 00065 00070 inline CTBxmlOStream& CTBxmlOStream::operator<<(char* c_text) 00071 { 00072 return operator<<((const char*) c_text); 00073 } 00074 00075 //------------------------------------------+----------------------------------- 00077 00078 inline CTBxmlOStream& CTBxmlOStream::operator<<(const CTBxmlStartTag& tag) 00079 { 00080 PutStartTag(tag.Name()); 00081 return *this; 00082 } 00083 00084 //------------------------------------------+----------------------------------- 00086 00087 inline CTBxmlOStream& CTBxmlOStream::operator<<(const CTBxmlEmptyTag& tag) 00088 { 00089 PutEmptyTag(tag.Name()); 00090 return *this; 00091 } 00092 00093 //------------------------------------------+----------------------------------- 00095 00096 inline CTBxmlOStream& CTBxmlOStream::operator<<(const CTBxmlEndTag& tag) 00097 { 00098 PutEndTag(); 00099 return *this; 00100 } 00101 00102 //------------------------------------------+----------------------------------- 00104 00108 template <class T> 00109 inline CTBxmlOStream& operator<<(CTBxmlOStream& xos, const T& obj) 00110 { 00111 ostream* p_os = xos.Stream(); 00112 if (p_os) { 00113 *p_os << obj; 00114 } else { 00115 xos.SetBad(); 00116 } 00117 return xos; 00118 } 00119 00120 //############################################################################## 00126 //------------------------------------------+----------------------------------- 00128 00129 inline CTBxmlStartTag::CTBxmlStartTag(const char* c_name) 00130 : mc_name(c_name) 00131 {} 00132 00133 //------------------------------------------+----------------------------------- 00135 00136 inline const char* CTBxmlStartTag::Name() const 00137 { 00138 return mc_name; 00139 } 00140 00141 //############################################################################## 00142 00148 //------------------------------------------+----------------------------------- 00150 00151 inline CTBxmlEmptyTag::CTBxmlEmptyTag(const char* c_name) 00152 : mc_name(c_name) 00153 {} 00154 00155 //------------------------------------------+----------------------------------- 00157 00158 inline const char* CTBxmlEmptyTag::Name() const 00159 { 00160 return mc_name; 00161 } 00162 00163 //############################################################################## 00164 00170 //------------------------------------------+----------------------------------- 00172 00173 inline CTBxmlEndTag::CTBxmlEndTag() 00174 {}