#ifndef STRING_H #define STRING_H /* * @(#)String.h * * This file is part of webCDwriter - Network CD/DVD Writing. * * Copyright (C) 2002-2005 Jörg P. M. Haeger * * webCDwriter is free software. See CDWserver.cpp for details. */ #include #include "Object.h" class String: public Object { class StringBuffer *buf; char *bytes; boolean tmp; int validityMark; static const int originalValidityMark; public: String(); String(const String &str); String(String *str); String(const char *str); String(class StringBuffer &buffer); String(class StringBuffer *buffer); ~String(); String &operator=(String &str); String &operator=(String *str); String &operator=(const char *str); String &operator+(char c); String &operator+(int i); String &operator+(off_t n); String &operator+(String &str); String &operator+(String *str); String &operator+(const char *str); int charAt(int index) const; int compareToIgnoreCase(const char *str); int endsWith(const char *suffix) const; int equals(const char *str) const; int equals(String &str) const; int equalsIgnoreCase(const char *str) const; static void free(String *str); const char *getBytes(); int indexOf(const char *str, int fromIndex = 0) const; public: boolean instanceof(const char *objectName) { return equal(objectName, "String") || Object::instanceof(objectName); } int lastIndexOf(const char *str) const; int length() const; String *replace(char oldChar, char newChar); private: inline void resetBytes(); public: int startsWith(const char *prefix) const; String *substring(int beginIndex) const; String *substring(int beginIndex, int endIndex) const; public: String *toString() { return new String(*this); } String *toUpperCase() const; static String *valueOf(int i); static String *valueOf(off_t n); }; class EmptyString { public: String e; }; extern EmptyString S; #endif