TString


class description - source file - inheritance tree

class TString

    private:
void Clone() void Clone(Ssiz_t nc) protected:
TString TString(char* a1, Ssiz_t n1, char* a2, Ssiz_t n2) Ssiz_t AdjustCapacity(Ssiz_t nc) void AssertElement(Ssiz_t nc) void Clobber(Ssiz_t nc) void Cow() void Cow(Ssiz_t nc) void InitChar(char c) TStringRef* Pref() public:
TString TString() TString TString(Ssiz_t ic) TString TString(TString& s) TString TString(char* s) TString TString(char* s, Ssiz_t n) TString TString(char c) TString TString(char c, Ssiz_t s) TString TString(TSubString& sub) TString Copy() virtual void ~TString() TString& Append(char* cs) TString& Append(char* cs, Ssiz_t n) TString& Append(TString& s) TString& Append(TString& s, Ssiz_t n) TString& Append(char c, Ssiz_t rep = 1) Bool_t BeginsWith(char* s, TString::ECaseCompare cmp = kExact) Bool_t BeginsWith(TString& pat, TString::ECaseCompare cmp = kExact) Ssiz_t Capacity() Ssiz_t Capacity(Ssiz_t n) TString& Chop() TClass* Class() int CompareTo(char* cs, TString::ECaseCompare cmp = kExact) int CompareTo(TString& st, TString::ECaseCompare cmp = kExact) Bool_t Contains(char* pat, TString::ECaseCompare cmp = kExact) Bool_t Contains(TString& pat, TString::ECaseCompare cmp = kExact) const char* Data() Bool_t EndsWith(char* pat, TString::ECaseCompare cmp = kExact) virtual void FillBuffer(char*& buffer) Ssiz_t First(char c) Ssiz_t First(char* cs) Ssiz_t GetInitialCapacity() Ssiz_t GetMaxWaste() Ssiz_t GetResizeIncrement() unsigned int Hash(TString::ECaseCompare cmp = kExact) Ssiz_t Index(char* pat, Ssiz_t i = 0, TString::ECaseCompare cmp = kExact) Ssiz_t Index(TString& s, Ssiz_t i = 0, TString::ECaseCompare cmp = kExact) Ssiz_t Index(char* pat, Ssiz_t patlen, Ssiz_t i, TString::ECaseCompare cmp) Ssiz_t Index(TString& s, Ssiz_t patlen, Ssiz_t i, TString::ECaseCompare cmp) Ssiz_t Index(TRegexp& pat, Ssiz_t i = 0) Ssiz_t Index(TRegexp& pat, Ssiz_t* ext, Ssiz_t i = 0) Ssiz_t InitialCapacity(Ssiz_t ic = 15) TString& Insert(Ssiz_t pos, char* s) TString& Insert(Ssiz_t pos, char* s, Ssiz_t extent) TString& Insert(Ssiz_t pos, TString& s) TString& Insert(Ssiz_t pos, TString& s, Ssiz_t extent) virtual TClass* IsA() Bool_t IsAscii() Bool_t IsNull() Ssiz_t Last(char c) Ssiz_t Length() Ssiz_t MaxWaste(Ssiz_t mw = 15) char* operator const char*() char operator()(Ssiz_t n) TSubString operator()(Ssiz_t start, Ssiz_t len) TSubString operator()(TRegexp& re) TSubString operator()(TRegexp& re, Ssiz_t start) TString& operator+=(char* s) TString& operator+=(TString& s) TString& operator=(char s) TString& operator=(char* s) TString& operator=(TString& s) TString& operator=(TSubString& s) char operator[](Ssiz_t n) TString& Prepend(char* cs) TString& Prepend(char* cs, Ssiz_t n) TString& Prepend(TString& s) TString& Prepend(TString& s, Ssiz_t n) TString& Prepend(char c, Ssiz_t rep = 1) virtual void ReadBuffer(char*& buffer) istream& ReadFile(istream& str) istream& ReadLine(istream& str, Bool_t skipWhite = kTRUE) istream& ReadString(istream& str) istream& ReadToDelim(istream& str, char delim = n) istream& ReadToken(istream& str) TString& Remove(Ssiz_t pos) TString& Remove(Ssiz_t pos, Ssiz_t n) TString& Replace(Ssiz_t pos, Ssiz_t n, char* s) TString& Replace(Ssiz_t pos, Ssiz_t n, char* s, Ssiz_t ns) TString& Replace(Ssiz_t pos, Ssiz_t n, TString& s) TString& Replace(Ssiz_t pos, Ssiz_t n1, TString& s, Ssiz_t n2) TString& ReplaceAll(TString& s1, TString& s2) TString& ReplaceAll(TString& s1, char* s2) TString& ReplaceAll(char* s1, TString& s2) TString& ReplaceAll(char* s1, char* s2) TString& ReplaceAll(char* s1, Ssiz_t ls1, char* s2, Ssiz_t ls2) void Resize(Ssiz_t n) Ssiz_t ResizeIncrement(Ssiz_t ri = 16) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual Int_t Sizeof() virtual void Streamer(TBuffer& b) TSubString Strip(TString::EStripType s = kTrailing, char c = ) TSubString SubString(char* pat, Ssiz_t start = 0, TString::ECaseCompare cmp = kExact) void ToLower() void ToUpper()

Data Members

private:
static Ssiz_t fgInitialCapac Initial allocation Capacity static Ssiz_t fgResizeInc Resizing increment static Ssiz_t fgFreeboard Max empty space before reclaim protected:
char* fData ref. counted data (TStringRef is in front) public:
static const TString::EStripType kLeading static const TString::EStripType kTrailing static const TString::EStripType kBoth static const TString::ECaseCompare kExact static const TString::ECaseCompare kIgnoreCase


See also

TStringLong

Class Description

                                                                      
 TString                                                              
                                                                      
 Basic string class.                                                  
                                                                      
 Cannot be stored in a TCollection... use TObjString instead.         
                                                                      


Ssiz_t GetInitialCapacity()

Ssiz_t GetResizeIncrement()

Ssiz_t GetMaxWaste()
______________________________________________________________________________

TString()
 TString default ctor.

TString(Ssiz_t ic)
 Create TString able to contain ic characters.

TString(const char* cs)
 Create TString and initialize it with string cs.

TString(const char* cs, Ssiz_t n)
 Create TString and initialize it with the first n characters of cs.

void InitChar(char c)
 Initialize a string with a single character.

TString(char c, Ssiz_t n)
 Initialize the first n locations of a TString with character c.

TString(const TSubString& substr)
 Copy a TSubString in a TString.

~TString()
 Delete a TString. I.e. decrease its reference count. When 0 free space.

Ssiz_t Capacity(Ssiz_t nc)
 Return string capacity. If nc != current capacity Clone() the string
 in a string with the desired capacity.

int CompareTo(const char* cs2, ECaseCompare cmp) const
 Compare a string to char *cs2.

int CompareTo(const TString& str, ECaseCompare cmp) const
 Compare a string to another string.

TString Copy() const
 Copy a string.

unsigned Hash(ECaseCompare cmp) const
 Return hash value.

Ssiz_t Index(const char* pattern, Ssiz_t plen, Ssiz_t startIndex, ECaseCompare cmp) const
 Search for a string in the TString. Plen is the length of pattern,
 startIndex is the index from which to start and cmp selects the type
 of case-comparison.

void Resize(Ssiz_t n)
 Resize the string. Truncate or add blanks as necessary.

TSubString Strip(EStripType st, char c)
 Return a substring of self stripped at beginning and/or end.

TSubString Strip(EStripType st, char c) const
 Just use the "non-const" version, adjusting the return type.

void ToLower()
 Change string to lower-case.

void ToUpper()
 Change string to upper case.

void AssertElement(Ssiz_t i) const
 Check to make sure a string index is in range.

TString(const char* a1, Ssiz_t n1, const char* a2, Ssiz_t n2)
 Special constructor to initialize with the concatenation of a1 and a2.

Ssiz_t AdjustCapacity(Ssiz_t nc)
 Calculate a nice capacity greater than or equal to nc.

void Clobber(Ssiz_t nc)
 Clear string and make sure it has a capacity of nc.

void Clone()
 Make string a distinct copy; preserve previous contents.

void Clone(Ssiz_t nc)
 Make self a distinct copy with capacity of at least nc.
 Preserve previous contents.

void FillBuffer(char *&buffer)
 Copy string into I/O buffer.

void ReadBuffer(char *&buffer)
 Read string from I/O buffer.

Int_t Sizeof() const
 Returns size string will occupy on I/O buffer.

void Streamer(TBuffer &b)
 Stream a string object

Ssiz_t InitialCapacity(Ssiz_t ic)
 Set default initial capacity for all TStrings. Default is 15.

Ssiz_t ResizeIncrement(Ssiz_t ri)
 Set default resize increment for all TStrings. Default is 16.

Ssiz_t MaxWaste(Ssiz_t mw)
 Set maximum space that may be wasted in a string before doing a resize.
 Default is 15.

TSubString SubString(const char* pattern, Ssiz_t startIndex, ECaseCompare cmp)
 Returns a substring matching "pattern", or the null substring
 if there is no such match.  It would be nice if this could be yet another
 overloaded version of operator(), but this would result in a type
 conversion ambiguity with operator(Ssiz_t, Ssiz_t).

TSubString SubString(const char* pattern, Ssiz_t startIndex, ECaseCompare cmp) const
 Return sub-string matching pattern, starting at index. Cmp selects
 the type of case conversion.

Bool_t IsAscii() const
 Return true if all characters in string are ascii.

Bool_t EndsWith(const char* s, ECaseCompare cmp) const



Inline Functions


        TStringRef* Pref()
               void Cow()
               void Cow(Ssiz_t nc)
            TString TString(char c, Ssiz_t s)
            TString TString(TSubString& sub)
              char* operator const char*()
           TString& operator=(char s)
           TString& operator=(char* s)
           TString& operator=(TString& s)
           TString& operator=(TSubString& s)
           TString& operator+=(char* s)
           TString& operator+=(TString& s)
               char operator[](Ssiz_t n)
               char operator()(Ssiz_t n)
         TSubString operator()(Ssiz_t start, Ssiz_t len)
         TSubString operator()(TRegexp& re)
         TSubString operator()(TRegexp& re, Ssiz_t start)
           TString& Append(char* cs)
           TString& Append(char* cs, Ssiz_t n)
           TString& Append(TString& s)
           TString& Append(TString& s, Ssiz_t n)
           TString& Append(char c, Ssiz_t rep = 1)
             Bool_t BeginsWith(char* s, TString::ECaseCompare cmp = kExact)
             Bool_t BeginsWith(TString& pat, TString::ECaseCompare cmp = kExact)
             Ssiz_t Capacity(Ssiz_t n)
           TString& Chop()
             Bool_t Contains(char* pat, TString::ECaseCompare cmp = kExact)
             Bool_t Contains(TString& pat, TString::ECaseCompare cmp = kExact)
        const char* Data()
             Ssiz_t First(char c)
             Ssiz_t First(char* cs)
             Ssiz_t Index(TString& s, Ssiz_t i = 0, TString::ECaseCompare cmp = kExact)
             Ssiz_t Index(char* pat, Ssiz_t patlen, Ssiz_t i, TString::ECaseCompare cmp)
             Ssiz_t Index(TString& s, Ssiz_t patlen, Ssiz_t i, TString::ECaseCompare cmp)
             Ssiz_t Index(TRegexp& pat, Ssiz_t i = 0)
             Ssiz_t Index(TRegexp& pat, Ssiz_t* ext, Ssiz_t i = 0)
           TString& Insert(Ssiz_t pos, char* s)
           TString& Insert(Ssiz_t pos, char* s, Ssiz_t extent)
           TString& Insert(Ssiz_t pos, TString& s)
           TString& Insert(Ssiz_t pos, TString& s, Ssiz_t extent)
             Bool_t IsNull()
             Ssiz_t Last(char c)
             Ssiz_t Length()
           TString& Prepend(char* cs)
           TString& Prepend(char* cs, Ssiz_t n)
           TString& Prepend(TString& s)
           TString& Prepend(TString& s, Ssiz_t n)
           TString& Prepend(char c, Ssiz_t rep = 1)
           istream& ReadFile(istream& str)
           istream& ReadLine(istream& str, Bool_t skipWhite = kTRUE)
           istream& ReadString(istream& str)
           istream& ReadToDelim(istream& str, char delim = n)
           istream& ReadToken(istream& str)
           TString& Remove(Ssiz_t pos)
           TString& Remove(Ssiz_t pos, Ssiz_t n)
           TString& Replace(Ssiz_t pos, Ssiz_t n, char* s)
           TString& Replace(Ssiz_t pos, Ssiz_t n, char* s, Ssiz_t ns)
           TString& Replace(Ssiz_t pos, Ssiz_t n, TString& s)
           TString& Replace(Ssiz_t pos, Ssiz_t n1, TString& s, Ssiz_t n2)
           TString& ReplaceAll(TString& s1, TString& s2)
           TString& ReplaceAll(TString& s1, char* s2)
           TString& ReplaceAll(char* s1, TString& s2)
           TString& ReplaceAll(char* s1, char* s2)
           TString& ReplaceAll(char* s1, Ssiz_t ls1, char* s2, Ssiz_t ls2)
            TClass* Class()
            TClass* IsA()
               void ShowMembers(TMemberInspector& insp, char* parent)


Author: Fons Rademakers 04/08/95
Last update: 2.22/02 24/05/99 17.08.12 by Fons Rademakers
Copyright (c) 1995-1999, The ROOT System, All rights reserved. *


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.