Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

CTBline.cxx

Go to the documentation of this file.
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 #include "CTB.hxx"
00015 #include "CTBline.hxx"
00016 
00024 //------------------------------------------+-----------------------------------
00026 
00027 CTBline::CTBline()
00028   : mb_streamvalid(true),
00029     m_stream("",0),
00030     mb_continue(false),
00031     mc_comment(0),
00032     mb_trimwhite(false),
00033     mb_tolower(false),
00034     mb_skipempty(false)
00035 {}
00036 
00037 //------------------------------------------+-----------------------------------
00039 
00040 CTBline::~CTBline()
00041 {}
00042 
00043 //------------------------------------------+-----------------------------------
00045 
00046 void CTBline::Set(const char* c_line)
00047 {
00048   m_string = c_line;
00049   SetupString();
00050   return;
00051 }
00052 
00053 //------------------------------------------+-----------------------------------
00054 #ifdef DEV_DOCS
00055 
00056 #endif
00057 
00058 void CTBline::FromStream(istream& is)
00059 {
00060   for (;;) {
00061     bool b_ok = m_string.GetLine(is);
00062     SetupString();
00063     if (!b_ok || !mb_skipempty || m_string.Length() > 0) break;
00064   }
00065   return;
00066 }
00067 
00068 //------------------------------------------+-----------------------------------
00070 
00071 void CTBline::SetupString()
00072 {
00073   if (mb_trimwhite) m_string.TrimWhite();
00074   if (mb_tolower)   m_string.ToLowerCase();
00075   mb_streamvalid = false;
00076   return;
00077 }
00078 
00079 //------------------------------------------+-----------------------------------
00081 
00082 void CTBline::SetupStream()
00083 {
00084   m_stream.~istrstream();                                   // placement dtor
00085   new((void*)&m_stream) istrstream((const char*)m_string);  // placement ctor
00086   mb_streamvalid = true;
00087   return;
00088 }
00089 

Generated at Fri Oct 24 18:11:28 2003 for CTBbase by doxygen1.2.9-20010812 written by Dimitri van Heesch, © 1997-2001