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

CTBcstring.hxx

Go to the documentation of this file.
00001 #ifndef _CTBcstring_HXX
00002 #define _CTBcstring_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 template <CTBint DIM>
00017 class CTBcstring {
00018   public: 
00019 
00020                     CTBcstring();
00021     explicit        CTBcstring(const char* c_src);
00022                     CTBcstring(const char* c_src, CTBint i_length);
00023 
00024                     CTBcstring(const CTBcstring<DIM>& rhs);
00025 
00026     CTBint          Size() const;
00027     CTBint          Length() const;
00028   
00029     void            Copy(const char* c_src, 
00030                          CTBint i_offset = 0, CTBint i_length = DIM-1);
00031 
00032     void            Append(const char* c_src,
00033                       CTBint i_offset = 0, CTBint i_length = DIM-1);
00034 
00035     void            Trim();
00036     void            Toupper();
00037     void            Tolower();
00038 
00039     bool            Get(long& i_val, int i_base = 0) const; 
00040     bool            Get(unsigned long& i_val, int i_base = 0) const; 
00041     bool            Get(int& i_val, int i_base = 0) const; 
00042     bool            Get(unsigned int& i_val, int i_base = 0) const; 
00043     bool            Get(double& d_val) const;
00044     bool            Get(float& f_val) const;
00045 
00046     CTBint          Locate(char c_char) const;
00047 
00048     int             NField(const char* c_delim = 0) const;
00049     bool            CopyField(const char* c_src,
00050                       CTBint i_ind = 0, const char *c_delim = 0);
00051 
00052     bool            GetLine(istream& is);
00053     bool            FromStream(istream& is);
00054   
00055     char&           operator[](CTBint i_ind);
00056     const char&     operator[](CTBint i_ind) const;
00057 
00058                     operator char*();
00059                     operator const char*() const;
00060 
00061     bool            operator==(const char* rhs) const;
00062 
00063     CTBcstring<DIM>&  operator=(const char* rhs);
00064 
00065     CTBcstring<DIM>&  operator+=(const char* rhs);
00066 
00067   protected: 
00068 
00069     char            m_data[DIM];
00070 };
00071 
00072 template <CTBint DIM>
00073 ostream& operator<<(ostream& os, const CTBcstring<DIM>& obj);
00074 template <CTBint DIM>
00075 istream& operator>>(istream& is, CTBcstring<DIM>& obj);
00076 
00077 
00078 #include "CTBcstring.icc"
00079 
00080 #endif

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