summaryrefslogtreecommitdiff
path: root/Source/Library/Common
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-11-25 18:42:44 +0100
committerAlexis211 <alexis211@gmail.com>2009-11-25 18:42:44 +0100
commita40fe1166ab1db972a8ca0380d603c4d90eede62 (patch)
treef92c2c02d9d78d68f7c116dff9ac508895f757af /Source/Library/Common
parentf367fe4e5a7712bafc121ce5c228f15e90fc5c93 (diff)
downloadMelon-a40fe1166ab1db972a8ca0380d603c4d90eede62.tar.gz
Melon-a40fe1166ab1db972a8ca0380d603c4d90eede62.zip
Re-organized file system stuff.
Diffstat (limited to 'Source/Library/Common')
-rw-r--r--Source/Library/Common/BasicString.class.cpp1
-rw-r--r--Source/Library/Common/BasicString.class.h2
-rw-r--r--Source/Library/Common/String.class.cpp1
-rw-r--r--Source/Library/Common/String.class.h2
4 files changed, 4 insertions, 2 deletions
diff --git a/Source/Library/Common/BasicString.class.cpp b/Source/Library/Common/BasicString.class.cpp
index f3a6164..58fa926 100644
--- a/Source/Library/Common/BasicString.class.cpp
+++ b/Source/Library/Common/BasicString.class.cpp
@@ -175,6 +175,7 @@ Vector< BasicString<T> > BasicString<T>::split(T sep) const {
template <typename T>
BasicString<T> BasicString<T>::substr(s32int start, u32int size) {
if (start < 0) start = m_length - start;
+ if (size == 0) size = m_length - start;
BasicString<T> ret;
ret.m_string = new T[size + 1];
ret.m_length = size;
diff --git a/Source/Library/Common/BasicString.class.h b/Source/Library/Common/BasicString.class.h
index 21041e8..be74cf3 100644
--- a/Source/Library/Common/BasicString.class.h
+++ b/Source/Library/Common/BasicString.class.h
@@ -46,7 +46,7 @@ class BasicString {
bool contains(const T& chr) const;
Vector< BasicString<T> > split(T sep) const;
- BasicString<T> substr(s32int start, u32int size);
+ BasicString<T> substr(s32int start, u32int size = 0);
};
#include "BasicString.class.cpp"
diff --git a/Source/Library/Common/String.class.cpp b/Source/Library/Common/String.class.cpp
index a824eac..da2b93e 100644
--- a/Source/Library/Common/String.class.cpp
+++ b/Source/Library/Common/String.class.cpp
@@ -193,6 +193,7 @@ Vector<String> String::split(WChar c) const {
String String::substr(s32int start, u32int size) {
if (start < 0) start = m_length - start;
+ if (size == 0) size = m_length - start;
String ret;
ret.m_string = new WChar[size + 1];
ret.m_length = size;
diff --git a/Source/Library/Common/String.class.h b/Source/Library/Common/String.class.h
index 0d48ce6..473624b 100644
--- a/Source/Library/Common/String.class.h
+++ b/Source/Library/Common/String.class.h
@@ -43,7 +43,7 @@ class String : public BasicString<WChar> {
Vector<String> split(WChar c) const;
- String substr(s32int start, u32int size);
+ String substr(s32int start, u32int size = 0);
};
#endif