ROOT logo
ROOT » CORE » BASE » TSubString

class TSubString


TString

Basic string class.

Cannot be stored in a TCollection... use TObjString instead.


Function Members (Methods)

public:
TSubString(const TSubString& s)
~TSubString()
const char*Data() const
Bool_tIsNull() const
Ssiz_tLength() const
intoperator!() const
char&operator()(Ssiz_t i)
charoperator()(Ssiz_t i) const
TSubString&operator=(const char* s)
TSubString&operator=(const TString& s)
TSubString&operator=(const TSubString& s)
char&operator[](Ssiz_t i)
charoperator[](Ssiz_t i) const
Ssiz_tStart() const
TString&String()
voidToLower()
voidToUpper()
protected:
voidAssertElement(Ssiz_t i) const
voidSubStringError(Ssiz_t, Ssiz_t, Ssiz_t) const
private:
TSubString(const TString& s, Ssiz_t start, Ssiz_t len)

Data Members

private:
Ssiz_tfBeginIndex of starting character
Ssiz_tfExtentLength of TSubString
TString&fStrReferenced string

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

const char * Data() const
 Return a pointer to the beginning of the substring. Note that the
 terminating null is in the same place as for the original
 TString, so this method is not appropriate for converting the
 TSubString to a string. To do that, construct a TString from the
 TSubString. For example:

   root [0] TString s("hello world")
   root [1] TSubString sub=s(0, 5)
   root [2] sub.Data()
   (const char* 0x857c8b8)"hello world"
   root [3] TString substr(sub)
   root [4] substr
   (class TString)"hello"
char operator[](Ssiz_t i) const
 Access to elements of sub-string with bounds checking
{ AssertElement(i); return fStr.fData[fBegin+i]; }
char operator()(Ssiz_t i) const
{ return fStr.fData[fBegin+i]; }
TSubString & operator=(const TSubString& s)
{ fStr = s.fStr; fBegin = s.fBegin; fExtent = s.fExtent; return *this; }
Ssiz_t Length() const
{ return fNchars; }
char & operator[](Ssiz_t i)
{ return ((char*)(this+1))[i]; }
TSubString(const TString& s, Ssiz_t start, Ssiz_t len)
 NB: the only constructor is private
void SubStringError(Ssiz_t , Ssiz_t , Ssiz_t ) const
void AssertElement(Ssiz_t i) const
TSubString(const TSubString& s)
{ }
TSubString & operator=(const char* s)
TSubString & operator=(const TString& s)
char & operator()(Ssiz_t i)
Ssiz_t Start() const
{ return fBegin; }
void ToLower()
void ToUpper()
Bool_t IsNull() const
 For detecting null substrings
{ return fBegin == kNPOS; }
int operator!() const
{ return fBegin == kNPOS; }