SNAP Library , Developer Reference  2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TRStr Class Reference

#include <dt.h>

List of all members.

Public Member Functions

 TRStr ()
 TRStr (const int &Len)
 TRStr (const char *CStr)
 TRStr (const char *CStr, const int &MxLen)
 TRStr (const char *CStr1, const char *CStr2)
 TRStr (const char &Ch)
 TRStr (const char &Ch1, const char &Ch2)
 ~TRStr ()
 TRStr (TSIn &SIn, const bool &IsSmall)
void Save (TSOut &SOut, const bool &IsSmall) const
TRStroperator= (const TRStr &)
int GetMemUsed () const
void MkRef ()
void UnRef ()
const char * CStr () const
char * CStr ()
bool Empty () const
int Len () const
void PutCh (const int &ChN, const char &Ch)
char GetCh (const int &ChN) const
bool IsUc () const
void ToUc ()
bool IsLc () const
void ToLc ()
void ToCap ()
void ConvUsFromYuAscii ()
int GetPrimHashCd () const
int GetSecHashCd () const

Static Public Member Functions

static int CmpI (const char *CStr1, const char *CStr2)
static TRStrGetNullRStr ()

Public Attributes

char * Bf
int Refs

Detailed Description

Definition at line 339 of file dt.h.


Constructor & Destructor Documentation

TRStr::TRStr ( ) [inline]

Definition at line 344 of file dt.h.

References Bf, and Refs.

{Refs=1; Bf=new char[0+1]; Bf[0]=0;}
TRStr::TRStr ( const int &  Len) [inline]

Definition at line 345 of file dt.h.

References Bf, IAssert, Len(), and Refs.

                       {
    IAssert(Len>=0); Refs=0; Bf=new char[Len+1]; Bf[Len]=0;}

Here is the call graph for this function:

TRStr::TRStr ( const char *  CStr) [inline]

Definition at line 347 of file dt.h.

References Bf, and Refs.

                         {
    Refs=0; Bf=new char[strlen(CStr)+1]; strcpy(Bf, CStr);}
TRStr::TRStr ( const char *  CStr,
const int &  MxLen 
) [inline]

Definition at line 349 of file dt.h.

References Bf, and Refs.

                                           {
    Refs=0; Bf=new char[MxLen+1]; strncpy(Bf, CStr, MxLen); Bf[MxLen]=0;}
TRStr::TRStr ( const char *  CStr1,
const char *  CStr2 
) [inline]

Definition at line 351 of file dt.h.

References Bf, and Refs.

                                             {
    Refs=0; int CStr1Len=int(strlen(CStr1)); Bf=new char[CStr1Len+int(strlen(CStr2))+1];
    strcpy(Bf, CStr1); strcpy(Bf+CStr1Len, CStr2);}
TRStr::TRStr ( const char &  Ch) [inline]

Definition at line 354 of file dt.h.

References Bf, and Refs.

                       {
    Refs=0; Bf=new char[1+1]; Bf[0]=Ch; Bf[1]=0;}
TRStr::TRStr ( const char &  Ch1,
const char &  Ch2 
) [inline]

Definition at line 356 of file dt.h.

References Bf, and Refs.

                                         {
    Refs=0; Bf=new char[2+1]; Bf[0]=Ch1; Bf[1]=Ch2; Bf[2]=0;}
TRStr::~TRStr ( ) [inline]

Definition at line 358 of file dt.h.

References Assert, Bf, GetNullRStr(), and Refs.

          {
    Assert(((this!=GetNullRStr())&&(Refs==0))||((this==GetNullRStr())&&(Refs==1)));
    delete[] Bf;}

Here is the call graph for this function:

TRStr::TRStr ( TSIn SIn,
const bool &  IsSmall 
) [inline, explicit]

Definition at line 361 of file dt.h.

References Bf, TSIn::Load(), and Refs.

                                                {
    if (IsSmall){Refs=0; SIn.Load(Bf);}
    else {Refs=0; int BfL; SIn.Load(BfL); SIn.Load(Bf, BfL, BfL);}}

Here is the call graph for this function:


Member Function Documentation

int TRStr::CmpI ( const char *  CStr1,
const char *  CStr2 
) [static]

Definition at line 675 of file dt.cpp.

                                           {
  if (!p){return r ? (*r ? -1 : 0) : 0;}
  if (!r){return (*p ? 1 : 0);}
  while (*p && *r){
    int i=int(toupper(*p++))-int(toupper(*r++));
    if (i!=0){return i;}
  }
  return int(toupper(*p++))-int(toupper(*r++));
}

Definition at line 669 of file dt.cpp.

References Bf, TCh::GetUsFromYuAscii(), and Len().

Referenced by TStr::ConvUsFromYuAscii().

                             {
  int StrLen=Len();
  for (int ChN=0; ChN<StrLen; ChN++){
    Bf[ChN]=TCh::GetUsFromYuAscii(Bf[ChN]);}
}

Here is the call graph for this function:

Here is the caller graph for this function:

const char* TRStr::CStr ( ) const [inline]
char* TRStr::CStr ( ) [inline]

Definition at line 375 of file dt.h.

References Bf.

{return Bf;}
bool TRStr::Empty ( ) const [inline]

Definition at line 376 of file dt.h.

References Bf.

Referenced by TStr::Empty().

{return Bf[0]==0;}

Here is the caller graph for this function:

char TRStr::GetCh ( const int &  ChN) const [inline]

Definition at line 381 of file dt.h.

References Assert, Bf, and Len().

Referenced by TStr::GetCh(), and TStr::operator[]().

                                   {
    Assert((0<=ChN)&&(ChN<Len())); return Bf[ChN];}

Here is the call graph for this function:

Here is the caller graph for this function:

int TRStr::GetMemUsed ( ) const [inline]

Definition at line 369 of file dt.h.

References Bf.

Referenced by TStr::GetMemUsed().

{return int(sizeof(int))+int(strlen(Bf));}

Here is the caller graph for this function:

static TRStr* TRStr::GetNullRStr ( ) [inline, static]

Definition at line 395 of file dt.h.

References Assert, and Bf.

Referenced by TStr::Clr(), TStr::GetRStr(), TStr::Optimize(), TStr::TStr(), and ~TRStr().

                             {
    static TRStr NullRStr; Assert(NullRStr.Bf!=NULL); return &NullRStr;}

Here is the caller graph for this function:

int TRStr::GetPrimHashCd ( ) const

Definition at line 685 of file dt.cpp.

References Bf.

Referenced by TStr::GetPrimHashCd().

Here is the caller graph for this function:

int TRStr::GetSecHashCd ( ) const

Definition at line 689 of file dt.cpp.

References Bf.

Referenced by TStr::GetSecHashCd().

Here is the caller graph for this function:

bool TRStr::IsLc ( ) const

Definition at line 648 of file dt.cpp.

References Bf, and Len().

Referenced by TStr::IsLc().

                       {
  int StrLen=Len();
  for (int ChN=0; ChN<StrLen; ChN++){
    if (('A'<=Bf[ChN])&&(Bf[ChN]<='Z')){return false;}}
  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool TRStr::IsUc ( ) const

Definition at line 636 of file dt.cpp.

References Bf, and Len().

Referenced by TStr::IsUc().

                       {
  int StrLen=Len();
  for (int ChN=0; ChN<StrLen; ChN++){
    if (('a'<=Bf[ChN])&&(Bf[ChN]<='z')){return false;}}
  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int TRStr::Len ( ) const [inline]

Definition at line 377 of file dt.h.

References Bf.

Referenced by ConvUsFromYuAscii(), GetCh(), IsLc(), IsUc(), TStr::Len(), PutCh(), ToCap(), ToLc(), ToUc(), and TRStr().

{return int(strlen(Bf));}

Here is the caller graph for this function:

void TRStr::MkRef ( ) [inline]

Definition at line 371 of file dt.h.

References Refs.

Referenced by TStr::ChangeChAll(), TStr::Clr(), TStr::ConvUsFromYuAscii(), TStr::operator+=(), TStr::operator=(), TStr::Optimize(), TStr::PutCh(), TStr::ToCap(), TStr::ToLc(), TStr::ToUc(), and TStr::TStr().

{Refs++;}

Here is the caller graph for this function:

TRStr& TRStr::operator= ( const TRStr ) [inline]

Definition at line 368 of file dt.h.

References Fail.

{Fail; return *this;}
void TRStr::PutCh ( const int &  ChN,
const char &  Ch 
) [inline]

Definition at line 379 of file dt.h.

References Assert, Bf, and Len().

Referenced by TStr::PutCh().

                                            {
    Assert((0<=ChN)&&(ChN<Len())); Bf[ChN]=Ch;}

Here is the call graph for this function:

Here is the caller graph for this function:

void TRStr::Save ( TSOut SOut,
const bool &  IsSmall 
) const [inline]

Definition at line 364 of file dt.h.

References Bf, and TSOut::Save().

Referenced by TStr::Save().

                                                    {
    if (IsSmall){SOut.Save(Bf);}
    else {int BfL=int(strlen(Bf)); SOut.Save(BfL); SOut.Save(Bf, BfL);}}

Here is the call graph for this function:

Here is the caller graph for this function:

void TRStr::ToCap ( )

Definition at line 661 of file dt.cpp.

References Bf, and Len().

Referenced by TStr::ToCap().

                 {
  int StrLen=Len();
  if (StrLen>0){
    Bf[0]=(char)toupper(Bf[0]);}
  for (int ChN=1; ChN<StrLen; ChN++){
    Bf[ChN]=(char)tolower(Bf[ChN]);}
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TRStr::ToLc ( )

Definition at line 655 of file dt.cpp.

References Bf, and Len().

Referenced by TStr::ToLc().

                {
  int StrLen=Len();
  for (int ChN=0; ChN<StrLen; ChN++){
    Bf[ChN]=(char)tolower(Bf[ChN]);}
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TRStr::ToUc ( )

Definition at line 643 of file dt.cpp.

References Bf, and Len().

Referenced by TStr::ToUc().

                {
  int StrLen=Len();
  for (int ChN=0; ChN<StrLen; ChN++){
    Bf[ChN]=(char)toupper(Bf[ChN]);}}

Here is the call graph for this function:

Here is the caller graph for this function:

void TRStr::UnRef ( ) [inline]

Definition at line 372 of file dt.h.

References Assert, and Refs.

Referenced by TStr::ChangeChAll(), TStr::Clr(), TStr::ConvUsFromYuAscii(), TStr::operator+=(), TStr::operator=(), TStr::Optimize(), TStr::PutCh(), TStr::ToCap(), TStr::ToLc(), TStr::ToUc(), and TStr::~TStr().

{Assert(Refs>0); if (--Refs==0){delete this;}}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 342 of file dt.h.

Referenced by MkRef(), TRStr(), UnRef(), and ~TRStr().


The documentation for this class was generated from the following files: