From a24aa25390b8a648a90fb12a0eac6726840be716 Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Sat, 19 Sep 2009 17:44:34 +0200 Subject: More work --- Source/Kernel/Library/BasicString.class.h | 5 +++++ Source/Kernel/Library/String.class.cpp | 19 ------------------- Source/Kernel/Library/String.class.h | 20 +++++--------------- Source/Kernel/Melon.ke | Bin 160815 -> 160747 bytes 4 files changed, 10 insertions(+), 34 deletions(-) (limited to 'Source/Kernel') diff --git a/Source/Kernel/Library/BasicString.class.h b/Source/Kernel/Library/BasicString.class.h index a4d56c7..f2c03a7 100644 --- a/Source/Kernel/Library/BasicString.class.h +++ b/Source/Kernel/Library/BasicString.class.h @@ -21,13 +21,18 @@ class BasicString { void affect(const BasicString &other); void affect(const T* string, u32int length); void affect(const T value, u32int count = 1); + void operator= (const BasicString &other) { affect(other); } bool compare(const BasicString &other) const; bool compare(const T* string, u32int length) const; + bool operator== (const BasicString &other) const { return compare(other); } + bool operator!= (const BasicString &other) const { return !compare(other); } 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 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 e43953f..4e72540 100644 --- a/Source/Kernel/Library/String.class.cpp +++ b/Source/Kernel/Library/String.class.cpp @@ -117,7 +117,6 @@ 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); @@ -175,24 +174,6 @@ u64int String::toInt16() const { return number; } -WChar& String::operator[] (int index) const { - return m_string[index]; -} - -u32int String::size() const { - return m_length; -} - -void String::clear() { - delete [] m_string; - m_length = 0; - m_string = 0; -} - -bool String::empty() const { - return (m_length == 0); -} - Vector String::split(WChar c) const { Vector ret; ret.push(String("")); diff --git a/Source/Kernel/Library/String.class.h b/Source/Kernel/Library/String.class.h index ad1524d..a10ba7a 100644 --- a/Source/Kernel/Library/String.class.h +++ b/Source/Kernel/Library/String.class.h @@ -15,24 +15,20 @@ class String : public BasicString { String(const String &other); virtual ~String(); - void affect(const String &other) { BasicString::affect(other); } void affect(const char* string, u8int encoding = UE_UTF8); - void operator= (const String &other) { affect(other); } void operator= (const char* other) { affect(other); } + void operator= (const String& other) { BasicString::affect(other); } - bool compare(const String &other) const { return BasicString::compare(other); } bool compare(const char* string, u8int encoding = UE_UTF8) const; - bool operator== (const String &other) const { return compare(other); } bool operator== (const char* other) const { return compare(other); } - bool operator!= (const String &other) { return !compare(other); } bool operator!= (const char* other) { return !compare(other); } + bool operator== (const String& other) const { return BasicString::compare(other); } + bool operator!= (const String& other) const { return !BasicString::compare(other); } - String& append(const String &other) { BasicString::append(other); return *this; } String& append(const char* other, u8int encoding = UE_UTF8); - String& append(WChar other) { BasicString::append(other); return *this; } - String &operator+= (const String &other) { return append(other); } + String &operator+= (const String &other) { BasicString::append(other); return *this; } String &operator+= (const char* other) { return append(other); } - String &operator+= (WChar other) { return append(other); } + String &operator+= (WChar other) { BasicString::append(other); return *this; } String concat(const String &other) const; String concat(const char* other, u8int encoding = UE_UTF8) const; @@ -44,12 +40,6 @@ class String : public BasicString { s64int toInt() const; //Convert from DEC u64int toInt16() const; //Convert from HEX - WChar& operator[] (int index) const; - - u32int size() const; - void clear(); - bool empty() const; - Vector split(WChar c) const; String substr(s32int start, u32int size); diff --git a/Source/Kernel/Melon.ke b/Source/Kernel/Melon.ke index 9f88bf0..aaecba6 100755 Binary files a/Source/Kernel/Melon.ke and b/Source/Kernel/Melon.ke differ -- cgit v1.2.3