diff options
Diffstat (limited to 'Source/Kernel')
-rw-r--r-- | Source/Kernel/Library/BasicString.class.h | 4 | ||||
-rw-r--r-- | Source/Kernel/Library/String.class.cpp | 25 | ||||
-rw-r--r-- | Source/Kernel/Library/String.class.h | 5 | ||||
-rwxr-xr-x | Source/Kernel/Melon.ke | bin | 160747 -> 160963 bytes |
4 files changed, 8 insertions, 26 deletions
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<T>& append(const BasicString<T> &other); BasicString<T>& append(const T* string, u32int length); BasicString<T>& append(const T other); - String& operator+= (const BasicString<T> &other) { return append(other); } - String& operator+= (const T other) { return append(other); } + BasicString<T>& operator+= (const BasicString<T> &other) { return append(other); } + BasicString<T>& operator+= (const T other) { return append(other); } BasicString<T> concat(const BasicString<T> &other) const; BasicString<T> 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<WChar> () { -} - 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<WChar> (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<WChar> { static String number(s32int number); String(const char* string, u8int encoding = UE_UTF8); - String(); - String(const String &other); - virtual ~String(); + String() : BasicString<WChar>() {} + String(const String &other) : BasicString<WChar> (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 Binary files differindex aaecba6..6ece4a6 100755 --- a/Source/Kernel/Melon.ke +++ b/Source/Kernel/Melon.ke |