Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

StrPtr Class Template Reference

Inheritance diagram for StrPtr:

Inheritance graph
[legend]
Collaboration diagram for StrPtr:

Collaboration graph
[legend]

template<class T>
class StrPtr< T >


Public Member Functions

void Allocate (int n)
void Deallocate ()
int Find (const char *p)
const char * GetBuffer ()
int GetLength ()
const char * Left (int n)
void MakeEmpty ()
void MakeLower ()
char & operator * () const
char & operator * ()
 operator char * ()
 operator const char * ()
 operator const unsigned char * ()
 operator unsigned char * ()
 operator void * ()
bool operator!= (const char *pStr) const
bool operator!= (char *pStr) const
bool operator!= (Str &rhs) const
Stroperator+= (const char c)
Stroperator+= (const char *pStr)
bool operator== (const char *pStr) const
bool operator== (char *pStr) const
bool operator== (const Str &rhs) const
char & operator[] (int nIndex) const
char & operator[] (int nIndex)
const char * Right (int n)

Protected Member Functions

TPtr ()
TRef ()
 StrPtr (const char *pStr, T *p)
 StrPtr ()

Protected Attributes

bool m_bIgnoreCase
Tm_pPtr
char * m_pStr

Constructor & Destructor Documentation

StrPtr  )  [inline, protected]
 

Definition at line 99 of file pakstuff.cpp.

References m_pPtr.

00100   {
00101     m_pPtr = NULL;
00102   }

StrPtr const char *  pStr,
T p
[inline, protected]
 

Definition at line 104 of file pakstuff.cpp.

References m_pPtr.

00104                                  : Str(pStr)
00105   {
00106     m_pPtr = p;
00107   }


Member Function Documentation

void Allocate int  n  )  [inline, inherited]
 

Definition at line 69 of file str.h.

00070   {
00071     Deallocate();
00072     m_pStr = new char[n];
00073   }

void Deallocate  )  [inline, inherited]
 

Definition at line 63 of file str.h.

00064   {
00065     delete []m_pStr;
00066     m_pStr = NULL;
00067   }

int Find const char *  p  )  [inline, inherited]
 

Definition at line 101 of file str.h.

References p, pf, and strstr().

Referenced by FindReplace(), and OpenPakFile().

00102   {
00103     char *pf = strstr(m_pStr, p);
00104     return (pf) ? (pf - m_pStr) : -1;
00105   }

Here is the call graph for this function:

const char* GetBuffer  )  [inline, inherited]
 

Definition at line 75 of file str.h.

Referenced by PakLoadAnyFile().

00076   {
00077     return m_pStr;
00078   }

int GetLength  )  [inline, inherited]
 

Definition at line 107 of file str.h.

References strlen().

Referenced by AddSlash(), and FindReplace().

00108   {
00109     return (m_pStr) ? strlen(m_pStr) : 0;
00110   }

Here is the call graph for this function:

const char* Left int  n  )  [inline, inherited]
 

Definition at line 112 of file str.h.

References g_pStrWork, n, and strncpy().

Referenced by FindReplace().

00113   {
00114     delete []g_pStrWork;
00115     if (n > 0)
00116     {
00117       g_pStrWork = new char[n+1];
00118       strncpy(g_pStrWork, m_pStr, n);
00119     }
00120     else
00121     {
00122       g_pStrWork = "";
00123       g_pStrWork = new char[1];
00124       g_pStrWork[0] = '\0';
00125     }
00126     return g_pStrWork;
00127   }

Here is the call graph for this function:

void MakeEmpty  )  [inline, inherited]
 

Definition at line 80 of file str.h.

References __StrDup().

00081   {
00082     Deallocate();
00083     m_pStr = __StrDup("");
00084   }

Here is the call graph for this function:

void MakeLower  )  [inline, inherited]
 

Definition at line 93 of file str.h.

References strlwr().

Referenced by OpenPakFile(), and PakLoadAnyFile().

00094   {
00095     if (m_pStr)
00096     {
00097       strlwr(m_pStr);
00098     }
00099   }

Here is the call graph for this function:

char& operator *  )  const [inline, inherited]
 

Definition at line 149 of file str.h.

00149 { return *const_cast<Str*>(this)->m_pStr; }

char& operator *  )  [inline, inherited]
 

Definition at line 148 of file str.h.

00148 { return *m_pStr; }

operator char *  )  [inline, inherited]
 

Definition at line 151 of file str.h.

00151 { return m_pStr; }

operator const char * void   )  [inline, inherited]
 

Definition at line 152 of file str.h.

00152 { return reinterpret_cast<const char*>(m_pStr); }

operator const unsigned char *  )  [inline, inherited]
 

Definition at line 154 of file str.h.

00154 { return reinterpret_cast<const unsigned char*>(m_pStr); }

operator unsigned char *  )  [inline, inherited]
 

Definition at line 153 of file str.h.

00153 { return reinterpret_cast<unsigned char*>(m_pStr); }

operator void *  )  [inline, inherited]
 

Definition at line 150 of file str.h.

00150 { return m_pStr; }

bool operator!= const char *  pStr  )  const [inline, inherited]
 

Definition at line 206 of file str.h.

References strcmp().

00206 { return (m_bIgnoreCase) ? stricmp(m_pStr, pStr) != 0 : strcmp(m_pStr, pStr) != 0; }

Here is the call graph for this function:

bool operator!= char *  pStr  )  const [inline, inherited]
 

Definition at line 205 of file str.h.

References strcmp().

00205 { return (m_bIgnoreCase) ? stricmp(m_pStr, pStr) != 0 : strcmp(m_pStr, pStr) != 0; }

Here is the call graph for this function:

bool operator!= Str rhs  )  const [inline, inherited]
 

Definition at line 204 of file str.h.

References Str::m_pStr, and strcmp().

00204 { return (m_bIgnoreCase) ? stricmp(m_pStr, rhs.m_pStr) != 0 : strcmp(m_pStr, rhs.m_pStr) != 0; }

Here is the call graph for this function:

Str& operator+= const char  c  )  [inline, inherited]
 

Definition at line 195 of file str.h.

References c.

00196   {
00197     return operator+=(&c);
00198   }

Str& operator+= const char *  pStr  )  [inline, inherited]
 

Definition at line 175 of file str.h.

References __StrDup(), p, strcat(), strcpy(), and strlen().

00176   {
00177     if (pStr)
00178     {
00179       if (m_pStr)
00180       {
00181         char *p = new char[strlen(m_pStr) + strlen(pStr) + 1];
00182         strcpy(p, m_pStr);
00183         strcat(p, pStr);
00184         delete m_pStr;
00185         m_pStr = p;
00186       }
00187       else
00188       {
00189         m_pStr = __StrDup(pStr);
00190       }
00191     }
00192     return *this;
00193   }

Here is the call graph for this function:

bool operator== const char *  pStr  )  const [inline, inherited]
 

Definition at line 203 of file str.h.

References strcmp().

00203 { return (m_bIgnoreCase) ? stricmp(m_pStr, pStr) == 0 : strcmp(m_pStr, pStr) == 0; }

Here is the call graph for this function:

bool operator== char *  pStr  )  const [inline, inherited]
 

Definition at line 202 of file str.h.

References strcmp().

00202 { return (m_bIgnoreCase) ? stricmp(m_pStr, pStr) == 0 : strcmp(m_pStr, pStr) == 0; }

Here is the call graph for this function:

bool operator== const Str rhs  )  const [inline, inherited]
 

Definition at line 201 of file str.h.

References Str::m_pStr, and strcmp().

00201 { return (m_bIgnoreCase) ? stricmp(m_pStr, rhs.m_pStr) == 0 : strcmp(m_pStr, rhs.m_pStr) == 0; }

Here is the call graph for this function:

char& operator[] int  nIndex  )  const [inline, inherited]
 

Definition at line 208 of file str.h.

00208 { return m_pStr[nIndex]; }

char& operator[] int  nIndex  )  [inline, inherited]
 

Definition at line 207 of file str.h.

00207 { return m_pStr[nIndex]; }

T* Ptr  )  [inline, protected]
 

Definition at line 109 of file pakstuff.cpp.

References T.

00110   {
00111     return m_pPtr;
00112   }

T& Ref  )  [inline, protected]
 

Definition at line 114 of file pakstuff.cpp.

References T.

00115   {
00116     return *m_pPtr;
00117   }

const char* Right int  n  )  [inline, inherited]
 

Definition at line 129 of file str.h.

References g_pStrWork, n, and strncpy().

Referenced by FindReplace().

00130   {
00131     delete []g_pStrWork;
00132     if (n > 0)
00133     {
00134       g_pStrWork = new char[n+1];
00135       int nStart = GetLength() - n;
00136       strncpy(g_pStrWork, &m_pStr[nStart], n);
00137       g_pStrWork[n] = '\0';
00138     }
00139     else
00140     {
00141       g_pStrWork = new char[1];
00142       g_pStrWork[0] = '\0';
00143     }
00144     return g_pStrWork;
00145   }

Here is the call graph for this function:


Field Documentation

bool m_bIgnoreCase [protected, inherited]
 

Definition at line 41 of file str.h.

T* m_pPtr [protected]
 

Definition at line 98 of file pakstuff.cpp.

Referenced by StrPtr().

char* m_pStr [protected, inherited]
 

Definition at line 42 of file str.h.

Referenced by Str::operator!=(), Str::operator=(), and Str::operator==().


The documentation for this class was generated from the following file:
Generated on Thu Aug 25 20:00:29 2005 for Quake III Arena by  doxygen 1.3.9.1