diff -r ec5387e121fa -r 146825d63b9a sources/mystring.h --- a/sources/mystring.h Wed Dec 10 19:26:13 2014 +0200 +++ b/sources/mystring.h Thu Dec 11 05:58:55 2014 +0200 @@ -38,6 +38,8 @@ class String; class StringList; +// ------------------------------------------------------------------------------------------------- + class String { public: @@ -125,6 +127,8 @@ std::string m_string; }; +// ------------------------------------------------------------------------------------------------- + class StringList : public List { public: @@ -135,14 +139,12 @@ METHOD join (const String& delim) -> String; }; +// ------------------------------------------------------------------------------------------------- + inline FUNCTION operator== (const char* a, const String& b) -> bool; inline FUNCTION operator+ (const char* a, const String& b) -> String; -// // ------------------------------------------------------------------------------------------------- -// -// IMPLEMENTATIONS -// inline METHOD String::is_empty() const -> bool @@ -150,9 +152,7 @@ return m_string[0] == '\0'; } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::append (const char* data) -> void @@ -160,9 +160,7 @@ m_string.append (data); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::append (char data) -> void @@ -170,9 +168,7 @@ m_string.push_back (data); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::append (const String& data) -> void @@ -180,9 +176,7 @@ m_string.append (data.chars()); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::begin() -> std::string::iterator @@ -190,9 +184,7 @@ return m_string.begin(); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::begin() const -> std::string::const_iterator @@ -200,18 +192,14 @@ return m_string.cbegin(); } -// // ------------------------------------------------------------------------------------------------- -// inline const char* String::chars() const { return m_string.c_str(); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::end() -> std::string::iterator @@ -219,9 +207,7 @@ return m_string.end(); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::end() const -> std::string::const_iterator @@ -229,9 +215,7 @@ return m_string.end(); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::clear() -> void @@ -239,9 +223,7 @@ m_string.clear(); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::remove (int pos) -> void @@ -249,9 +231,7 @@ m_string.erase (m_string.begin() + pos); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::insert (int pos, char c) -> void @@ -259,9 +239,7 @@ m_string.insert (m_string.begin() + pos, c); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::length() const -> int @@ -269,9 +247,7 @@ return m_string.length(); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::remove (int pos, int len) -> void @@ -279,9 +255,7 @@ m_string.replace (pos, len, ""); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::remove_from_start (int len) -> void @@ -289,9 +263,7 @@ remove (0, len); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::remove_from_end (int len) -> void @@ -299,9 +271,7 @@ remove (length() - len, len); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::replace (int pos, int n, const String& a) -> void @@ -309,9 +279,7 @@ m_string.replace (pos, n, a.chars()); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::shrink_to_fit() -> void @@ -319,18 +287,14 @@ m_string.shrink_to_fit(); } -// // ------------------------------------------------------------------------------------------------- -// inline const std::string& String::std_string() const { return m_string; } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::strip (char unwanted) -> String @@ -338,9 +302,7 @@ return strip ({unwanted}); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::operator+ (int num) const -> String @@ -348,9 +310,7 @@ return *this + String::from_number (num); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::operator+= (const String& data) -> String& @@ -359,9 +319,7 @@ return *this; } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::operator+= (const char* data) -> String& @@ -370,9 +328,7 @@ return *this; } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::operator+= (int num) -> String& @@ -380,9 +336,7 @@ return operator+= (String::from_number (num)); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::prepend (String a) -> void @@ -390,9 +344,7 @@ m_string = (a + m_string).std_string(); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::operator+= (char data) -> String& @@ -401,9 +353,7 @@ return *this; } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::operator== (const String& other) const -> bool @@ -411,9 +361,7 @@ return std_string() == other.std_string(); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::operator== (const char* other) const -> bool @@ -421,9 +369,7 @@ return operator== (String (other)); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::operator!= (const String& other) const -> bool @@ -431,9 +377,7 @@ return std_string() != other.std_string(); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::operator!= (const char* other) const -> bool @@ -441,9 +385,7 @@ return operator!= (String (other)); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::operator> (const String& other) const -> bool @@ -451,9 +393,7 @@ return std_string() > other.std_string(); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::operator< (const String& other) const -> bool @@ -461,27 +401,21 @@ return std_string() < other.std_string(); } -// // ------------------------------------------------------------------------------------------------- -// inline String::operator const char*() const { return chars(); } -// // ------------------------------------------------------------------------------------------------- -// inline String::operator const std::string&() const { return std_string(); } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::modify_index (int& a) -> void @@ -490,9 +424,7 @@ a = length() - a; } -// // ------------------------------------------------------------------------------------------------- -// inline METHOD String::index_difference (int a, int b) -> int @@ -502,9 +434,7 @@ return b - a; } -// // ------------------------------------------------------------------------------------------------- -// inline FUNCTION operator== (const char* a, const String& b) -> bool @@ -512,9 +442,7 @@ return b == a; } -// // ------------------------------------------------------------------------------------------------- -// inline FUNCTION operator+ (const char* a, const String& b) -> String