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 const char* CTBline::Get() const 00018 { 00019 return m_string; 00020 } 00021 00022 //------------------------------------------+----------------------------------- 00024 00025 inline void CTBline::ContinueLine(bool b_continue) 00026 { 00027 mb_continue = b_continue; 00028 return; 00029 } 00030 00031 //------------------------------------------+----------------------------------- 00033 00034 inline void CTBline::CommentDelimiter(char c_comment) 00035 { 00036 mc_comment = c_comment; 00037 return; 00038 } 00039 00040 //------------------------------------------+----------------------------------- 00042 00043 inline void CTBline::TrimWhite(bool b_trim) 00044 { 00045 mb_trimwhite = b_trim; 00046 return; 00047 } 00048 00049 //------------------------------------------+----------------------------------- 00051 00052 inline void CTBline::ToLowerCase(bool b_lower) 00053 { 00054 mb_tolower = b_lower; 00055 return; 00056 } 00057 00058 //------------------------------------------+----------------------------------- 00060 00061 inline void CTBline::SkipEmpty(bool b_skip) 00062 { 00063 mb_skipempty = b_skip; 00064 return; 00065 } 00066 00067 //------------------------------------------+----------------------------------- 00069 00070 inline bool CTBline::ContinueLine() const 00071 { 00072 return mb_continue; 00073 } 00074 00075 //------------------------------------------+----------------------------------- 00077 00078 inline char CTBline::CommentDelimiter() const 00079 { 00080 return mc_comment; 00081 } 00082 00083 //------------------------------------------+----------------------------------- 00085 00086 inline bool CTBline::TrimWhite() const 00087 { 00088 return mb_trimwhite; 00089 } 00090 00091 //------------------------------------------+----------------------------------- 00093 00094 inline bool CTBline::ToLowerCase() const 00095 { 00096 return mb_tolower; 00097 } 00098 00099 //------------------------------------------+----------------------------------- 00101 00102 inline bool CTBline::SkipEmpty() const 00103 { 00104 return mb_skipempty; 00105 } 00106 00107 //------------------------------------------+----------------------------------- 00109 00110 inline bool CTBline::Good() 00111 { 00112 return GetStream().good(); 00113 } 00114 00115 //------------------------------------------+----------------------------------- 00117 00118 inline bool CTBline::Fail() 00119 { 00120 return GetStream().fail(); 00121 } 00122 00123 //------------------------------------------+----------------------------------- 00125 00126 inline bool CTBline::Bad() 00127 { 00128 return GetStream().bad(); 00129 } 00130 00131 //------------------------------------------+----------------------------------- 00133 00134 inline bool CTBline::Eof() 00135 { 00136 return GetStream().eof(); 00137 } 00138 00139 //------------------------------------------+----------------------------------- 00140 #ifdef DEV_DOCS 00141 00142 #endif 00143 00144 inline istrstream& CTBline::GetStream() 00145 { 00146 if (!mb_streamvalid) SetupStream(); 00147 return m_stream; 00148 } 00149 00150 //------------------------------------------+----------------------------------- 00152 00153 inline bool CTBline::operator!() const 00154 { 00155 return (mb_streamvalid) ? !m_stream : false; 00156 } 00157 00158 //------------------------------------------+----------------------------------- 00160 00161 inline CTBline::operator void*() const 00162 { 00163 return (mb_streamvalid) ? (void*) m_stream : (void*) this; 00164 } 00165 00166 //------------------------------------------+----------------------------------- 00172 inline ostream& operator<<(ostream& os, const CTBline& obj) 00173 { 00174 os << obj.Get(); 00175 return os; 00176 } 00177 00178 //------------------------------------------+----------------------------------- 00184 inline istream& operator>>(istream& is, CTBline& obj) 00185 { 00186 obj.FromStream(is); 00187 return is; 00188 } 00189 00190 //------------------------------------------+----------------------------------- 00196 template <class T> 00197 inline CTBline& operator>>(CTBline& line, T& obj) 00198 { 00199 line.GetStream() >> obj; 00200 return line; 00201 } 00202