00001 #ifndef _CTBline_HXX 00002 #define _CTBline_HXX 1 00003 00008 /*----------------------------------------------------------------------------*/ 00009 /* C Tool Box: Designed and implemented by: */ 00010 /* Walter F.J. Mueller Gesellschaft fuer Schwerionenforschung (GSI) */ 00011 /* Planckstrasse 1, D-64291 Darmstadt, Germany */ 00012 /* Email: W.F.J.Mueller@gsi.de */ 00013 /* WWW: http://www-kp3.gsi.de/www/kp3/people/mueller.html */ 00014 /*------------------------------------------+---------------------------------*/ 00015 00016 #include <strstream.h> 00017 00018 #include "CTBstring.hxx" 00019 00020 class CTBline { 00021 public: 00022 CTBline(); 00023 ~CTBline(); 00024 00025 void Set(const char* c_line); 00026 const char* Get() const; 00027 00028 void ContinueLine(bool b_continue); 00029 void CommentDelimiter(char c_comment); 00030 void TrimWhite(bool b_trim); 00031 void ToLowerCase(bool b_lower); 00032 void SkipEmpty(bool b_skip); 00033 00034 bool ContinueLine() const; 00035 char CommentDelimiter() const; 00036 bool TrimWhite() const; 00037 bool ToLowerCase() const; 00038 bool SkipEmpty() const; 00039 00040 bool Good(); 00041 bool Fail(); 00042 bool Bad(); 00043 bool Eof(); 00044 00045 void FromStream(istream& is); 00046 istrstream& GetStream(); 00047 00048 bool operator!() const; 00049 operator void*() const; 00050 00051 private: 00052 00053 void SetupString(); 00054 void SetupStream(); 00055 00056 private: 00057 00058 CTBstring m_string; 00059 00060 bool mb_streamvalid; 00061 istrstream m_stream; 00062 00063 bool mb_continue; 00064 char mc_comment; 00065 bool mb_trimwhite; 00066 bool mb_tolower; 00067 bool mb_skipempty; 00068 }; 00069 00070 ostream& operator<<(ostream& os, const CTBline& obj); 00071 istream& operator>>(istream& is, CTBline& obj); 00072 00073 template <class T> 00074 CTBline& operator>>(CTBline& line, T& obj); 00075 00076 #include "CTBline.icc" 00077 00078 #endif