TString


class description - source file - inheritance tree

class TString

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


Author: Fons Rademakers 04/08/95
Last update: 2.23/09 20/11/99 11.13.25 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.