Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes | Private Member Functions
string Class Reference

#include <string.hpp>

List of all members.

Public Member Functions

 string (int reserve=7)
 string (const char *s2)
 string (const string &s2)
 ~string ()
stringoperator= (const string &s2)
char & operator[] (int i)

Public Attributes

int l
char * s
int n

Private Member Functions

 CONCRETE (string)
 string ()
 string (int n)
 string (char c)
 string (const char *s)
 string (const char *s, int n)
char & operator[] (int i)
bool operator== (const char *s)
bool operator!= (const char *s)
bool operator== (string s)
bool operator!= (string s)
string operator() (int start, int end)

Detailed Description

Definition at line 53 of file tm_maple_5.cpp.


Constructor & Destructor Documentation

string::string ( int  reserve = 7) [inline]

Definition at line 58 of file tm_maple_5.cpp.

                         :
    l (reserve+1), s (new char[l]), n (0) { s[0]='\0'; }
string::string ( const char *  s2) [inline]

Definition at line 60 of file tm_maple_5.cpp.

                         :
    l (strlen(s2)+1), s (new char[l]), n (l-1) { strcpy (s, s2); }
string::string ( const string s2) [inline]

Definition at line 62 of file tm_maple_5.cpp.

                           :
    l (s2.n+1), s (new char[l]), n (l-1) { strcpy (s, s2.s); }
string::~string ( ) [inline]

Definition at line 64 of file tm_maple_5.cpp.

{ delete[] s; }
string::string ( ) [inline, private]

Definition at line 34 of file string.hpp.

: rep (tm_new<string_rep> ()) {}
string::string ( int  n) [inline, private]

Definition at line 35 of file string.hpp.

: rep (tm_new<string_rep> (n)) {}
string::string ( char  c) [private]

Definition at line 51 of file string.cpp.

                      {
  rep= tm_new<string_rep> (1);
  rep->a[0]=c;
}
string::string ( const char *  s) [private]
string::string ( const char *  s,
int  n 
) [private]

Definition at line 63 of file string.cpp.

                                    {
  register int i;
  rep= tm_new<string_rep> (n);
  for (i=0; i<n; i++)
    rep->a[i]=a[i];
}

Member Function Documentation

string::CONCRETE ( string  ) [private]
bool string::operator!= ( const char *  s) [private]

Definition at line 86 of file string.cpp.

                                  {
  register int i, n= rep->n;
  register char* S= rep->a;
  for (i=0; i<n; i++) {
    if (s[i]!=S[i]) return true;
    if (s[i]=='\0') return true;
  }
  return (s[i]!='\0');
}
bool string::operator!= ( string  s) [private]

Definition at line 106 of file string.cpp.

                             {
  register int i;
  if (rep->n!=a->n) return true;
  for (i=0; i<rep->n; i++)
    if (rep->a[i]!=a->a[i]) return true;
  return false;
}
string string::operator() ( int  start,
int  end 
) [private]

Definition at line 115 of file string.cpp.

                                       {
  register int i;
  string r (end-begin);
  for (i=begin; i<end; i++) r[i-begin]=rep->a[i];
  return r;
}

Here is the call graph for this function:

string& string::operator= ( const string s2) [inline]

Definition at line 65 of file tm_maple_5.cpp.

                                        {
    if (this != &s2) {
      delete[] s;
      l= s2.n + 1;
      s= new char[l];
      n= l - 1;
    }
    return *this;
  }
bool string::operator== ( const char *  s) [private]

Definition at line 75 of file string.cpp.

                                  {
  register int i, n= rep->n;
  register char* S= rep->a;
  for (i=0; i<n; i++) {
    if (s[i]!=S[i]) return false;
    if (s[i]=='\0') return false;
  }
  return (s[i]=='\0');
}
bool string::operator== ( string  s) [private]

Definition at line 97 of file string.cpp.

                             {
  register int i;
  if (rep->n!=a->n) return false;
  for (i=0; i<rep->n; i++)
    if (rep->a[i]!=a->a[i]) return false;
  return true;
}
char& string::operator[] ( int  i) [inline, private]

Definition at line 39 of file string.hpp.

{ return rep->a[i]; }
char& string::operator[] ( int  i) [inline]

Definition at line 74 of file tm_maple_5.cpp.

{ return s[i]; }

Member Data Documentation

int string::l

Definition at line 55 of file tm_maple_5.cpp.

int string::n

Definition at line 57 of file tm_maple_5.cpp.

char* string::s

Definition at line 56 of file tm_maple_5.cpp.


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