1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef ULTIMA_STR_H 24 #define ULTIMA_STR_H 25 26 #include "common/str.h" 27 #include "common/array.h" 28 29 namespace Ultima { 30 namespace Shared { 31 32 class String; 33 34 typedef Common::Array<String> StringArray; 35 36 /** 37 * Derived string class 38 */ 39 class String : public Common::String { 40 public: String()41 String() : Common::String() {} String(const char * str)42 String(const char *str) : Common::String(str) {} String(const char * str,uint32 len)43 String(const char *str, uint32 len) : Common::String(str, len) {} String(const char * beginP,const char * endP)44 String(const char *beginP, const char *endP) : Common::String(beginP, endP) {} String(const String & str)45 String(const String &str) : Common::String(str) {} String(const Common::String & str)46 String(const Common::String &str) : Common::String(str) {} String(char c)47 explicit String(char c) : Common::String(c) {} 48 String& operator=(const String &str) { this->Common::String::operator=(str); return *this; } 49 50 /** 51 * Returns the index of a given character, or -1 if not present 52 */ 53 int indexOf(char c) const; 54 55 /** 56 * Returns the earliest index of any character in a passed set of characters, or -1 if not present 57 */ 58 int indexOf(const String &chars) const; 59 60 /** 61 * Splits up a text string by a given character 62 */ 63 StringArray split(char c) const; 64 65 /** 66 * Splits up a text string by any of the characters in the passed string 67 */ 68 StringArray split(const String &chars) const; 69 }; 70 71 } // End of namespace Shared 72 73 using Shared::String; 74 75 } // End of namespace Ultima 76 77 #endif 78