From 435b36921c10fecc363a61010e35cc8e508425dc Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Sat, 19 Sep 2009 18:27:28 +0200 Subject: END. --- Source/Kernel/Library/BasicString.class.h | 4 ++-- Source/Kernel/Library/String.class.cpp | 25 ++++--------------------- Source/Kernel/Library/String.class.h | 5 ++--- Source/Kernel/Melon.ke | Bin 160747 -> 160963 bytes 4 files changed, 8 insertions(+), 26 deletions(-) (limited to 'Source') diff --git a/Source/Kernel/Library/BasicString.class.h b/Source/Kernel/Library/BasicString.class.h index f2c03a7..5c69d00 100644 --- a/Source/Kernel/Library/BasicString.class.h +++ b/Source/Kernel/Library/BasicString.class.h @@ -31,8 +31,8 @@ class BasicString { BasicString& append(const BasicString &other); BasicString& append(const T* string, u32int length); BasicString& append(const T other); - String& operator+= (const BasicString &other) { return append(other); } - String& operator+= (const T other) { return append(other); } + BasicString& operator+= (const BasicString &other) { return append(other); } + BasicString& operator+= (const T other) { return append(other); } BasicString concat(const BasicString &other) const; BasicString concat(const T* string, u32int length) const; diff --git a/Source/Kernel/Library/String.class.cpp b/Source/Kernel/Library/String.class.cpp index 4e72540..693a11a 100644 --- a/Source/Kernel/Library/String.class.cpp +++ b/Source/Kernel/Library/String.class.cpp @@ -49,28 +49,10 @@ String String::number(s32int number) { return ret; } -String::String() : BasicString () { -} - String::String(const char* string, u8int encoding) { - m_length = WChar::utfLen(string, encoding); - if (m_length == 0) { - m_string = 0; - return; - } - m_string = new WChar[m_length + 1]; - int i = 0, l = strlen(string), c = 0; - while (i < l) { - i += m_string[c].affect(string + i, encoding); - c++; - } - m_string[m_length] = 0; -} - -String::String(const String &other) : BasicString (other) { -} - -String::~String() { + m_string = 0; + m_length = 0; + affect(string, encoding); } void String::affect (const char* string, u8int encoding) { @@ -117,6 +99,7 @@ String& String::append (const char* other, u8int encoding) { m_string[m_length] = 0; return *this; } + String String::concat (const String &other) const { //Can be optimized String ret(*this); return (ret += other); diff --git a/Source/Kernel/Library/String.class.h b/Source/Kernel/Library/String.class.h index a10ba7a..db274c9 100644 --- a/Source/Kernel/Library/String.class.h +++ b/Source/Kernel/Library/String.class.h @@ -11,9 +11,8 @@ class String : public BasicString { static String number(s32int number); String(const char* string, u8int encoding = UE_UTF8); - String(); - String(const String &other); - virtual ~String(); + String() : BasicString() {} + String(const String &other) : BasicString (other) {} void affect(const char* string, u8int encoding = UE_UTF8); void operator= (const char* other) { affect(other); } diff --git a/Source/Kernel/Melon.ke b/Source/Kernel/Melon.ke index aaecba6..6ece4a6 100755 Binary files a/Source/Kernel/Melon.ke and b/Source/Kernel/Melon.ke differ -- cgit v1.2.3