Main Page   Packages   Class Hierarchy   Alphabetical List   Data Structures   File List   Namespace Members   Data Fields   Globals  

String.h

Go to the documentation of this file.
00001 /*
00002  $Id: String.h,v 1.4 2002/07/29 21:27:42 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<Object.h>
00010 #include<Exception.h>
00011 #include<iostream.h>
00012 
00013 namespace clawsoft{
00023 class String:public Object{
00024         private:
00029                 char *buffer;
00034                 int len;
00038                 void assign(const char *s);
00042                 void assign(const int n);
00046                 void assign(const unsigned int n);
00050                 void assign(const float n);
00054                 void assign(const double n);
00058                 void assign(const long double n);
00062                 void assign(const long long n);
00067                 void destroy();
00068         protected:
00069         public:
00074                 String();
00080                 String(String &s);
00085                 String(const char *s);
00091                 String(const int n);
00097                 String(const unsigned int n);
00103                 String(const float n);
00109                 String(const double n);
00115                 String(const long double n);
00121                 String(const long long n);
00126                 ~String();
00130                 const char *toCharPtr();
00135                 void concat(const char *s);
00140                 void concat(String &s);
00145                 void concat(const int n);
00150                 void concat(const unsigned int n);
00155                 void concat(const float n);
00160                 void concat(const double n);
00165                 void concat(const long double n);
00170                 void concat(const long long n);
00174                 String& operator=(const char *s);
00179                 String& operator=(const int n);
00184                 String& operator=(const unsigned int n);
00189                 String& operator=(const float n);
00194                 String& operator=(const double n);
00199                 String& operator=(const long double n);
00204                 String& operator=(const long long n);
00210                 String& operator+(String &s);
00216                 String& operator+(const char *s);
00222                 String& operator+(const int n);
00228                 String& operator+(const unsigned int n);
00234                 String& operator+(const float n);
00240                 String& operator+(const double n);
00246                 String& operator+(const long double n);
00252                 String& operator+(const long long n);
00256                 String& operator+=(String &s);
00260                 String& operator+=(const char *s);
00264                 String& operator+=(const int n);
00268                 String& operator+=(const unsigned int n);
00272                 String& operator+=(const float n);
00276                 String& operator+=(const double n);
00280                 String& operator+=(const long double n);
00284                 String& operator+=(const long long n);
00295                 friend std::ostream& operator<<(std::ostream& stream, String s);
00296 
00300                 const char charAt(int i);
00305                 const char operator[](int i);
00306 
00312                 void deleteString();
00317                 String& trimLeft(const char c = ' ');
00322                 String& trimRight(const char c = ' ');
00327                 String& trim(const char c = ' ');
00331                 String& toUpperCase();
00335                 String& toLowerCase();
00340                 const unsigned int lenght();
00345                 const unsigned int size();
00351                 const int toInt();
00357                 const unsigned int toUInt();
00363                 const float toFloat();
00369                 const double toDouble();
00375                 const long double toLongDouble();
00381                 const long long toLongLong();
00382 
00386                 bool operator==(String &s);
00390                 bool operator==(const char *s);
00395                 bool operator==(const int n);
00400                 bool operator==(const unsigned int n);
00405                 bool operator==(const float n);
00410                 bool operator==(const double n);
00415                 bool operator==(const long double n);
00420                 bool operator==(const long long n);
00421 
00425                 bool equals(String &s);
00429                 bool equals(const char *s);
00434                 bool equals(const int n);
00439                 bool equals(const unsigned int n);
00444                 bool equals(const float n);
00449                 bool equals(const double n);
00454                 bool equals(const long double n);
00459                 bool equals(const long long n);
00460 
00464                 bool hasSubstring(String &s);
00468                 bool hasSubstring(const char *s);
00469 
00473                 String &deleteFirst();
00477                 String &deleteLast();
00478 
00483                 const int index(String &s, int start = 0);
00488                 const int index(const char *s, int start = 0);
00493                 const int index(const char c, int start = 0);
00494 
00499                 const int rindex(String &s, int end = 0);
00504                 const int rindex(const char *s, int end = 0);
00509                 const int rindex(const char c, int end = 0);
00510 
00520                 bool startsWith(String &s);
00525                 bool startsWith(const char *s);
00530                 bool endsWith(String &s);
00535                 bool endsWith(const char *s);
00536 
00541                 String &deleteCharAt(const int pos);
00542 
00547                 String &insertCharAt(const int pos, const char c);
00548 };
00549 
00550 };
00551 #endif

Powered by:

SourceForge Logo