00001 00007 #ifndef _STRING_H_ 00008 #define _STRING_H_ 00009 00010 #include <string.h> 00011 #include <stdlib.h> 00012 #include <stdarg.h> 00013 #include <stdio.h> 00014 00015 class String { 00016 public: 00017 String(); 00018 String(unsigned int cap); 00019 String(const char *string); 00020 String(const char *string, unsigned int len); 00021 String(const String &string); 00022 ~String(); 00023 00024 void setLength(const unsigned int newLength); 00025 unsigned int getLength() const { return length; }; 00026 bool isEmpty() const { return length == 0; }; 00027 00028 void assign(const char *string, const unsigned int len); 00029 void append(const char *string, const unsigned int len); 00030 bool insert(const unsigned int pos, const char *string, const unsigned int len); 00031 bool remove(const unsigned int pos, const unsigned int len); 00032 00033 operator const char*() const { return str; }; 00034 00035 void operator = (const char *string); 00036 void operator = (const String &string); 00037 void operator += (const char *string); 00038 void operator += (const String &string); 00039 00040 private: 00041 char *str; 00042 unsigned int length; 00043 unsigned int capasity; 00044 }; 00045 00046 #endif