summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-09-19 18:27:28 +0200
committerAlexis211 <alexis211@gmail.com>2009-09-19 18:27:28 +0200
commit435b36921c10fecc363a61010e35cc8e508425dc (patch)
treebdc8d5e86e87b3e0e343d4ae8f4b1a4d4aaaad42 /Source
parenta24aa25390b8a648a90fb12a0eac6726840be716 (diff)
downloadMelon-435b36921c10fecc363a61010e35cc8e508425dc.tar.gz
Melon-435b36921c10fecc363a61010e35cc8e508425dc.zip
END.
Diffstat (limited to 'Source')
-rw-r--r--Source/Kernel/Library/BasicString.class.h4
-rw-r--r--Source/Kernel/Library/String.class.cpp25
-rw-r--r--Source/Kernel/Library/String.class.h5
-rwxr-xr-xSource/Kernel/Melon.kebin160747 -> 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
index aaecba6..6ece4a6 100755
--- a/Source/Kernel/Melon.ke
+++ b/Source/Kernel/Melon.ke
Binary files differ