Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

MString Class Reference

#include <MString.h>

List of all members.

Public Methods

 MString ()
 MString (const char *)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

 MString (const MString &)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

 ~MString ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

const char * data () const
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

int length () const
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

void resize (int)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

MString & replace (int, int, const MString &)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

MString & operator+= (const char *)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

MString & operator+= (const MString &)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

MString & operator= (const char *)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

MString & operator= (const MString &)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

MString & operator= (char)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

 operator const char * () const
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

char & operator[] (int)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

char operator[] (int) const
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

char & operator() (int)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

char operator() (int) const
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

MString operator() (int, int)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...


Private Attributes

char * fString

Friends

int operator== (const MString &, const MString &)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

int operator!= (const MString &, const MString &)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

int operator== (const MString &, const char *)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...

int operator!= (const MString &, const char *)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//. More...


Constructor & Destructor Documentation

MString::MString  
 

Definition at line 29 of file MString.cxx.

References fString.

00031 :fString(NULL)
00034 {
00035   fString = DuplicateString("");
00036 }

MString::MString const char *    aString
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 38 of file MString.cxx.

00043 {
00044   fString = DuplicateString(aString==NULL?"":aString);
00045 }

MString::MString const MString &    aFrom
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 47 of file MString.cxx.

00052 {
00053   fString = DuplicateString(aFrom.fString);
00054 }

MString::~MString  
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 56 of file MString.cxx.

00060 {
00061   DeleteString(fString);
00062 }


Member Function Documentation

const char * MString::data   const
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 64 of file MString.cxx.

00068 {
00069   return fString;
00070 }

int MString::length   const
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 72 of file MString.cxx.

00076 {
00077   if(fString==NULL) return 0;
00078   return strlen(fString);
00079 }

MString::operator const char *   const
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 179 of file MString.cxx.

00183 { 
00184   return fString;
00185 }

MString MString::operator() int    aStart,
int    aLength
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 235 of file MString.cxx.

References fString, and MINIMUM.

00241 {
00242   MString s;
00243   if(fString==NULL) return s;
00244   if( (aStart<0) || (aStart>=length()) ) return s;
00245   int begin = aStart;
00246   int end = MINIMUM(aStart + aLength - 1,length()-1);
00247     DeleteString(s.fString);
00248   s.fString = Create(end - begin + 1);
00249   int pos = 0;
00250   for(int count=begin;count<=end;count++,pos++) {
00251     s.fString[pos] = fString[count];
00252   }
00253   return s;
00254 }

char MString::operator() int    aIndex const
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 226 of file MString.cxx.

00231 { 
00232   return (*this)[aIndex]; 
00233 }

char & MString::operator() int    aIndex
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 216 of file MString.cxx.

00222 { 
00223   return (*this)[aIndex]; 
00224 }

MString & MString::operator+= const MString &    aString
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 136 of file MString.cxx.

References fString.

00141 {
00142   *this += aString.fString;
00143   return *this;
00144 }

MString & MString::operator+= const char *    aString
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 126 of file MString.cxx.

00131 {
00132   fString = ConcatenateString(fString,aString);
00133   return *this;  
00134 }

MString & MString::operator= char    aChar
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 167 of file MString.cxx.

00172 {
00173   DeleteString(fString);
00174   fString = Create(1);
00175   fString[0] = aChar;
00176   return *this;
00177 }

MString & MString::operator= const MString &    aFrom
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 158 of file MString.cxx.

00163 {
00164   return (*this = aFrom.fString);
00165 }

MString & MString::operator= const char *    aString
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 146 of file MString.cxx.

00151 {
00152   if((fString!=NULL) && (aString==fString) ) return *this; 
00153   DeleteString(fString);
00154   fString = DuplicateString(aString==NULL?"":aString);
00155   return *this;
00156 }

char MString::operator[] int    aIndex const
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 202 of file MString.cxx.

00207 { 
00208   if((aIndex<0)||(aIndex>=length())) {
00209     printf("MString::operator[] : bad index %d %d\n",aIndex,length());
00210     //exit(EXIT_FAILURE);
00211     aIndex = 0;
00212   }
00213   return fString[aIndex]; 
00214 }

char & MString::operator[] int    aIndex
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 187 of file MString.cxx.

00193 { 
00194   if((aIndex<0)||(aIndex>=length())) {
00195     printf("MString::operator[] : bad index %d %d\n",aIndex,length());
00196     //exit(EXIT_FAILURE);
00197     aIndex = 0;
00198   }
00199   return fString[aIndex]; 
00200 }

MString & MString::replace int    aStart,
int    aLength,
const MString &    aString
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 102 of file MString.cxx.

References MINIMUM.

Referenced by Midnight::mncrck().

00109 {
00110   if(fString==NULL) return *this;
00111   if(aString.fString==NULL) return *this;
00112   if( (aStart<0) || (aStart>=length()) ) return *this;
00113   int begin = aStart;
00114   int end = MINIMUM(aStart + aLength - 1,length()-1);
00115   int l = aString.length();
00116   int pos = 0;
00117   for(int count=begin;count<=end;count++,pos++) {
00118     if(pos<l) 
00119       fString[count] = aString.fString[pos];
00120     else
00121       fString[count] = ' ';
00122   }
00123   return *this;
00124 }

void MString::resize int    aLength
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 81 of file MString.cxx.

Referenced by Midnight::mncntr(), and Midnight::mnplot().

00087 {
00088   if(fString==NULL) return;
00089   if(aLength<0) return;
00090   int l = strlen(fString);
00091   if(aLength<l) {
00092     fString[aLength] = '\0';
00093   } else {
00094     char* s = Create(aLength-l);
00095     if(s!=NULL) {
00096       fString = ConcatenateString(fString,s);
00097       freeBlock(s);
00098     }
00099   }
00100 }


Friends And Related Function Documentation

int operator!= const MString &    a1,
const char *    a2
[friend]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 290 of file MString.cxx.

00296 {
00297   return (a1==a2 ? 0 : 1);
00298 }

int operator!= const MString &    a1,
const MString &    a2
[friend]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 268 of file MString.cxx.

00274 {
00275   return (a1==a2 ? 0 : 1);
00276 }

int operator== const MString &    a1,
const char *    a2
[friend]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 278 of file MString.cxx.

00284 {
00285   if( a1.fString ==  a2) return 1; 
00286   if( (a1.fString==NULL) || (a2==NULL) ) return 0; 
00287   return (strcmp(a1.fString,a2)==0 ? 1: 0); 
00288 }

int operator== const MString &    a1,
const MString &    a2
[friend]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//.

Definition at line 256 of file MString.cxx.

00262 {
00263   if( a1.fString ==  a2.fString) return 1; 
00264   if( (a1.fString==NULL) || (a2.fString==NULL) ) return 0; 
00265   return (strcmp(a1.fString,a2.fString)==0 ? 1: 0); 
00266 }


Member Data Documentation

char* MString::fString [private]
 

Definition at line 42 of file MString.h.

Referenced by MString(), operator()(), and operator+=().


The documentation for this class was generated from the following files:
Generated on Thu Nov 29 16:38:57 2001 by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001