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 //------------------------------------------+----------------------------------- 00016 00017 inline int CTBxmlToken::Type() const 00018 { 00019 return mi_type; 00020 } 00021 00022 //------------------------------------------+----------------------------------- 00024 00025 inline const CTBstring& CTBxmlToken::Text() const 00026 { 00027 return m_text; 00028 } 00029 00030 //------------------------------------------+----------------------------------- 00032 00033 inline const CTBstring& CTBxmlToken::Name() const 00034 { 00035 return m_name; 00036 } 00037 00038 //------------------------------------------+----------------------------------- 00040 00041 inline const CTBstring& CTBxmlToken::Value() const 00042 { 00043 return m_value; 00044 } 00045 00046 //------------------------------------------+----------------------------------- 00048 00049 inline CTBint CTBxmlToken::NAttribute() const 00050 { 00051 return m_attribute.Size(); 00052 } 00053 00054 //------------------------------------------+----------------------------------- 00056 00057 inline const CTBstring& CTBxmlToken::AttributeName(CTBint i_ind) const 00058 { 00059 return m_attribute[i_ind].Key(); 00060 } 00061 00062 //------------------------------------------+----------------------------------- 00064 00065 inline const CTBstring& CTBxmlToken::AttributeValue(CTBint i_ind) const 00066 { 00067 return m_attribute[i_ind].Value(); 00068 } 00069 00070 //------------------------------------------+----------------------------------- 00072 00073 inline bool CTBxmlToken::operator!() const 00074 { 00075 return mi_type == invalid; 00076 } 00077 00078 //------------------------------------------+----------------------------------- 00080 00081 inline CTBxmlToken::operator void* () const 00082 { 00083 return (mi_type != invalid) ? (void*) this : 0; 00084 } 00085 00086 //------------------------------------------+----------------------------------- 00092 inline ostream& operator<<(ostream& os, const CTBxmlToken& obj) 00093 { 00094 obj.ToStream(os); 00095 return os; 00096 } 00097 00098 //############################################################################## 00099 00100 //------------------------------------------+----------------------------------- 00102 00103 inline bool CTBxmlIStream::Good() const 00104 { 00105 return mp_iss ? mp_iss->good() : !mb_fail; 00106 } 00107 00108 //------------------------------------------+----------------------------------- 00110 00111 inline bool CTBxmlIStream::Bad() const 00112 { 00113 return mp_iss ? mp_iss->bad() : mb_bad; 00114 } 00115 //------------------------------------------+----------------------------------- 00117 00118 inline bool CTBxmlIStream::Fail() const 00119 { 00120 return mp_iss ? mp_iss->fail() : mb_fail; 00121 } 00122 00123 //------------------------------------------+----------------------------------- 00125 00126 inline bool CTBxmlIStream::Eof() const 00127 { 00128 return mp_iss ? false : mb_eof; 00129 } 00130 00131 //------------------------------------------+----------------------------------- 00133 00134 inline bool CTBxmlIStream::Eod() const 00135 { 00136 return mp_iss ? mp_iss->eof() : true; 00137 } 00138 00139 //------------------------------------------+----------------------------------- 00141 00142 inline void CTBxmlIStream::TrimWhite(bool b_trim) 00143 { 00144 mb_trimwhite = b_trim; 00145 return; 00146 } 00147 00148 //------------------------------------------+----------------------------------- 00150 00151 inline void CTBxmlIStream::DropWhite(bool b_drop) 00152 { 00153 mb_dropwhite = b_drop; 00154 return; 00155 } 00156 00157 //------------------------------------------+----------------------------------- 00159 00160 inline bool CTBxmlIStream::TrimWhite() const 00161 { 00162 return mb_trimwhite; 00163 } 00164 00165 //------------------------------------------+----------------------------------- 00167 00168 inline bool CTBxmlIStream::DropWhite() const 00169 { 00170 return mb_dropwhite; 00171 } 00172 00173 //------------------------------------------+----------------------------------- 00175 00176 inline bool CTBxmlIStream::NextNotEnd() 00177 { 00178 int i_type = PeekTagOrNonWhiteData().Type(); 00179 return i_type != CTBxmlToken::fail && 00180 i_type != CTBxmlToken::eof && 00181 i_type != CTBxmlToken::endtag; 00182 } 00183 00184 //------------------------------------------+----------------------------------- 00186 00187 inline bool CTBxmlIStream::operator!() const 00188 { 00189 return Fail(); 00190 } 00191 00192 //------------------------------------------+----------------------------------- 00194 00195 inline CTBxmlIStream::operator void* () const 00196 { 00197 return (!Fail()) ? (void*) this : 0; 00198 } 00199 00200 //------------------------------------------+----------------------------------- 00202 00203 inline CTBxmlIStream& CTBxmlIStream::operator>>(CTBxmlToken& token) 00204 { 00205 Get(token); 00206 return *this; 00207 } 00208 00209 //------------------------------------------+----------------------------------- 00211 00212 inline CTBxmlIStream& CTBxmlIStream::operator>>(const CTBxmlOpen& manip) 00213 { 00214 OpenElement(manip.Name()); 00215 return *this; 00216 } 00217 00218 //------------------------------------------+----------------------------------- 00220 00221 inline CTBxmlIStream& CTBxmlIStream::operator>>(const CTBxmlClose& manip) 00222 { 00223 CloseElement(); 00224 return *this; 00225 } 00226 00227 //------------------------------------------+----------------------------------- 00233 template <class T> 00234 inline CTBxmlIStream& operator>>(CTBxmlIStream& xis, T& obj) 00235 { 00236 istream* p_is = xis.GetDataStream(); 00237 if (p_is) (*p_is) >> obj; 00238 return xis; 00239 } 00240 00241 //------------------------------------------+----------------------------------- 00247 inline ostream& operator<<(ostream& os, const CTBxmlIStream& obj) 00248 { 00249 obj.ToStream(os); 00250 return os; 00251 } 00252 00253 //############################################################################## 00259 //------------------------------------------+----------------------------------- 00261 00262 inline CTBxmlOpen::CTBxmlOpen(const char* c_name) 00263 : mc_name(c_name) 00264 {} 00265 00266 //------------------------------------------+----------------------------------- 00268 00269 inline const char* CTBxmlOpen::Name() const 00270 { 00271 return mc_name; 00272 } 00273 00274 //############################################################################## 00275 00281 //------------------------------------------+----------------------------------- 00283 00284 inline CTBxmlClose::CTBxmlClose() 00285 {}