/* * Baltisot * Copyright (C) 1999-2008 Nicolas "Pixel" Noble * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __STRING_H__ #define __STRING_H__ #include #include #include #include #include #include struct ugly_string { const char * p; }; class String : public Base { public: String(const String &); String(const char * = "", int = -1); String(char); String(int); String(unsigned int); String(int64); String(Uint64); String(double); ~String(); const char * set(const char *, va_list); const char * set(const char *, ...); const char * set(const ugly_string &, ...); int scanf(const char *, ...) const; int scanf(const ugly_string &, ...) const; const char * to_charp(size_t = 0, ssize_t = -1) const throw (GeneralException); String extract(size_t = 0, ssize_t = -1) const; char * strdup(size_t = 0, ssize_t = -1) const; int to_int(const char * fmt = "%i") const; double to_double() const; String to_sqldate() const; String to_sqltime() const; String from_sqldate() const; String from_sqltime() const; double datedif(const String &) const; bool is_date() const; bool is_number() const; bool is_float() const; bool is_time() const; size_t strlen() const; ssize_t strchr(char, size_t = 0) const; ssize_t strrchr(char) const; ssize_t strstr(const String &) const; int strchrcnt(char) const; String ltrim() const; String rtrim() const; String trim() const; String & operator=(const String &); String operator+(const String &) const; String & operator+=(const String &); bool operator!=(const String &) const; bool operator==(const String &) const; bool operator<=(const String &) const; bool operator>=(const String &) const; bool operator<(const String &) const; bool operator>(const String &) const; char operator[](size_t i) const; char & operator[](size_t i); operator ugly_string() const; String & toupper(); String & tolower(); String upper() const; String lower() const; String & iconv(const String & from, const String & to); private: String(int hs, char *); static char t[]; char * str; size_t siz; }; std::ostream & operator<<(std::ostream &, const String &); std::istream & operator>>(std::istream &, String &); String operator+(const char *, const String &); #endif