home *** CD-ROM | disk | FTP | other *** search
- #ifndef INCLUDE_TOOLS_STR_H
- #define INCLUDE_TOOLS_STR_H
- // Maxon C++:
- // String-Bibliothek
- // Jens Gelhar 14.12.91
- #ifndef __cplusplus
- #error "<tools/str.h> needs C++-Mode."
- #pragma +
- #endif
-
- class String
- { char *str;
- int len;
- void free();
- void alloc (const char*);
- public:
- String (const char* = 0);
- String (int, char*);
- String (const String &);
- String (char);
- ~String();
- operator char*() const
- { if (str) return str;
- else return "";
- }
- String &operator = (const String &);
- String &operator = (const char *);
- String &operator += (const String &);
- char operator[] (int i) const;
- int length() const
- { return len; }
- String left(int) const;
- String right(int) const;
- String mid(int,int) const;
- };
-
- String operator + (String s1, String s2);
-
- int operator == (const String &s1, const String &s2);
- int operator != (const String &s1, const String &s2);
- int operator < (const String &s1, const String &s2);
- int operator > (const String &s1, const String &s2);
- int operator <= (const String &s1, const String &s2);
- int operator >= (const String &s1, const String &s2);
-
- class ostream& operator << (ostream&, const String&);
-
- class istream& operator >> (istream&, String&);
-
- #endif
-