idep_String Class Reference

#include <idep_string.h>

List of all members.

Public Member Functions

 idep_String ()
 idep_String (const idep_String &idep_string)
 idep_String (const char *str)
 ~idep_String ()
idep_Stringoperator= (const idep_String &idep_string)
idep_Stringoperator= (const char *str)
idep_Stringoperator+= (const idep_String &idep_string)
idep_Stringoperator+= (const char *str)
 operator const char * () const
int length () const

Private Attributes

char * d_string_p

Detailed Description

Definition at line 11 of file idep_string.h.


Constructor & Destructor Documentation

idep_String::idep_String (  ) 

Definition at line 20 of file idep_string.cxx.

00021 : d_string_p(init(""))
00022 { 
00023 }

idep_String::idep_String ( const idep_String idep_string  ) 

Definition at line 25 of file idep_string.cxx.

00026 : d_string_p(init(string.d_string_p))
00027 { 
00028 }

idep_String::idep_String ( const char *  str  ) 

Definition at line 30 of file idep_string.cxx.

00031 : d_string_p(init(str))
00032 { 
00033 }

idep_String::~idep_String (  ) 

Definition at line 35 of file idep_string.cxx.

References d_string_p.

00036 {
00037     delete d_string_p;
00038 }


Member Function Documentation

int idep_String::length (  )  const

Definition at line 81 of file idep_string.cxx.

References d_string_p.

Referenced by operator+=().

00082 {
00083     return strlen(d_string_p);
00084 }    

idep_String::operator const char * (  )  const

Definition at line 76 of file idep_string.cxx.

References d_string_p.

00077 {
00078     return d_string_p;
00079 }

idep_String & idep_String::operator+= ( const char *  str  ) 

Definition at line 63 of file idep_string.cxx.

References d_string_p, len, length(), and size.

00064 {
00065     char *tmp = d_string_p;     
00066     int len = length();
00067     int size = strlen(str) + 1;
00068     d_string_p = new char[len + size];
00069     memcpy(d_string_p, tmp, len);
00070     memcpy(d_string_p + len, str, size);
00071     delete tmp;
00072     return *this;
00073 }

idep_String & idep_String::operator+= ( const idep_String idep_string  ) 

Definition at line 58 of file idep_string.cxx.

References d_string_p.

00059 {
00060     return *this += string.d_string_p;
00061 }

idep_String & idep_String::operator= ( const char *  str  ) 

Definition at line 50 of file idep_string.cxx.

References d_string_p, and init().

00051 {
00052     char *tmp = d_string_p;     // string could be a substring of itself
00053     d_string_p = init(str);
00054     delete tmp;
00055     return *this;
00056 }

idep_String & idep_String::operator= ( const idep_String idep_string  ) 

Definition at line 41 of file idep_string.cxx.

References d_string_p, and init().

00042 {
00043     if (this != &string) {
00044         delete d_string_p;
00045         d_string_p = init(string.d_string_p);
00046     }
00047     return *this;
00048 }


Member Data Documentation

char* idep_String::d_string_p [private]

Definition at line 12 of file idep_string.h.

Referenced by length(), operator const char *(), operator+=(), operator=(), and ~idep_String().


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

Generated on 16 Jan 2018 for loon by  doxygen 1.6.1