Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields  

String.h

00001 /*
00002  $Id: String.h,v 1.12 2003/09/04 20:26:38 mindstorm2600 Exp $
00003  This is the main header of the string class, here we're going to rewrite the old
00004  libclawsoft 0.3.0 to a more stable one, strings are commonly one of the biggest
00005  memory leak creation agents
00006  */
00007 #ifndef __CLAW_STRING_H__
00008 #define __CLAW_STRING_H__
00009 #include<System.h>
00010 #include<Exception.h>
00011 #include<iostream>
00012 
00013 namespace clawsoft{
00029 class String:public System{
00030         private:
00035                 char *buffer;
00040                 int len;
00045                 void destroy();
00046         protected:
00047         public:
00052                 String();
00058                 String(String &s);
00063                 String(const char *s);
00069                 String(const int n);
00075                 String(const unsigned int n);
00081                 String(const float n);
00087                 String(const double n);
00093                 String(const long double n);
00099                 String(const Sint64 n);
00104                 ~String();
00108                 void assign(const char *s);
00112                 void assign(const int n);
00116                 void assign(const unsigned int n);
00120                 void assign(const float n);
00124                 void assign(const double n);
00128                 void assign(const long double n);
00132                 void assign(const Sint64 n);
00136                 const char *toCharPtr();
00141                 void concat(const char *s);
00146                 void concat(String &s);
00151                 void concat(const int n);
00156                 void concat(const unsigned int n);
00161                 void concat(const float n);
00166                 void concat(const double n);
00171                 void concat(const long double n);
00176                 void concat(const Sint64 n);
00181                 void concat(const Uint64 n);
00185                 String& operator=(const char *s);
00190                 String& operator=(const int n);
00195                 String& operator=(const unsigned int n);
00200                 String& operator=(const float n);
00205                 String& operator=(const double n);
00210                 String& operator=(const long double n);
00215                 String& operator=(const Sint64 n);
00216                 //String& operator=(const String &s);
00222                 String& operator+(String &s);
00228                 String& operator+(const char *s);
00234                 String& operator+(const int n);
00240                 String& operator+(const unsigned int n);
00246                 String& operator+(const float n);
00252                 String& operator+(const double n);
00258                 String& operator+(const long double n);
00264                 String& operator+(const Sint64 n);
00270                 String& operator+(const Uint64 n);
00274                 String& operator+=(String &s);
00278                 String& operator+=(const char *s);
00282                 String& operator+=(const int n);
00286                 String& operator+=(const unsigned int n);
00290                 String& operator+=(const float n);
00294                 String& operator+=(const double n);
00298                 String& operator+=(const long double n);
00302                 String& operator+=(const Sint64 n);
00306                 String& operator+=(const Uint64 n);
00317                 friend std::ostream& operator<<(std::ostream& stream, String s);
00318 
00322                 const char charAt(int i);
00327                 const char operator[](int i);
00328 
00334                 void deleteString();
00339                 String& trimLeft(const char c = ' ');
00344                 String& trimRight(const char c = ' ');
00349                 String& trim(const char c = ' ');
00353                 String& toUpperCase();
00357                 String& toLowerCase();
00362                 const unsigned int lenght();
00367                 const unsigned int size();
00373                 const int toInt();
00379                 const unsigned int toUInt();
00385                 const float toFloat();
00391                 const double toDouble();
00397                 const long double toLongDouble();
00403                 const Sint64 toInt64();
00404 
00408                 bool operator==(const String &s);
00412                 bool operator==(const char *s);
00417                 bool operator==(const int n);
00422                 bool operator==(const unsigned int n);
00427                 bool operator==(const float n);
00432                 bool operator==(const double n);
00437                 bool operator==(const long double n);
00442                 bool operator==(const Sint64 n);
00446                 static bool equals(const String &s1, const String &s2);
00447 
00451                 bool equals(const String &s);
00455                 bool equals(const char *s);
00460                 bool equals(const int n);
00465                 bool equals(const unsigned int n);
00470                 bool equals(const float n);
00475                 bool equals(const double n);
00480                 bool equals(const long double n);
00485                 bool equals(const Sint64 n);
00486 
00490                 bool hasSubstring(String &s);
00494                 bool hasSubstring(const char *s);
00495 
00499                 String &deleteFirst();
00503                 String &deleteLast();
00504 
00509                 const int index(String &s, int start = 0);
00514                 const int index(const char *s, int start = 0);
00519                 const int index(const char c, int start = 0);
00520 
00525                 const int rindex(String &s, int end = 0);
00530                 const int rindex(const char *s, int end = 0);
00535                 const int rindex(const char c, int end = 0);
00536 
00541                 bool startsWith(String &s);
00546                 bool startsWith(const char *s);
00552                 bool startsIWith(const char *s);
00557                 bool endsWith(String &s);
00562                 bool endsWith(const char *s);
00563 
00568                 String &deleteCharAt(const int pos);
00569 
00574                 String &insertCharAt(const int pos, const char c);
00575 };
00576 
00577 };
00578 #endif

Authors:

Juan V. Guerrero
Jannette C. Mejia
Juan C. Guevara

Powered by:

SourceForgeLogo