Update to v098r10 release.

byuu says:

Changelog:
- synchronized tomoko, loki, icarus with extensive changes to nall
  (118KiB diff)
This commit is contained in:
Tim Allen
2016-05-16 19:51:12 +10:00
parent 6ae0abe3d3
commit 3ebc77c148
105 changed files with 1281 additions and 824 deletions

View File

@@ -2,19 +2,19 @@
namespace nall {
auto string::trim(rstring lhs, rstring rhs, long limit) -> string& {
rtrim(rhs, limit);
ltrim(lhs, limit);
auto string::trim(string_view lhs, string_view rhs, long limit) -> string& {
trimRight(rhs, limit);
trimLeft(lhs, limit);
return *this;
}
auto string::ltrim(rstring lhs, long limit) -> string& {
auto string::trimLeft(string_view lhs, long limit) -> string& {
if(lhs.size() == 0) return *this;
long matches = 0;
while(matches < limit) {
signed offset = lhs.size() * matches;
signed length = (signed)size() - offset;
if(length < (signed)lhs.size()) break;
int offset = lhs.size() * matches;
int length = (int)size() - offset;
if(length < (int)lhs.size()) break;
if(memory::compare(data() + offset, lhs.data(), lhs.size()) != 0) break;
matches++;
}
@@ -22,13 +22,13 @@ auto string::ltrim(rstring lhs, long limit) -> string& {
return *this;
}
auto string::rtrim(rstring rhs, long limit) -> string& {
auto string::trimRight(string_view rhs, long limit) -> string& {
if(rhs.size() == 0) return *this;
long matches = 0;
while(matches < limit) {
signed offset = (signed)size() - rhs.size() * (matches + 1);
signed length = (signed)size() - offset;
if(offset < 0 || length < (signed)rhs.size()) break;
int offset = (int)size() - rhs.size() * (matches + 1);
int length = (int)size() - offset;
if(offset < 0 || length < (int)rhs.size()) break;
if(memory::compare(data() + offset, rhs.data(), rhs.size()) != 0) break;
matches++;
}
@@ -36,19 +36,19 @@ auto string::rtrim(rstring rhs, long limit) -> string& {
return *this;
}
auto string::itrim(rstring lhs, rstring rhs, long limit) -> string& {
irtrim(rhs, limit);
iltrim(lhs, limit);
auto string::itrim(string_view lhs, string_view rhs, long limit) -> string& {
itrimRight(rhs, limit);
itrimLeft(lhs, limit);
return *this;
}
auto string::iltrim(rstring lhs, long limit) -> string& {
auto string::itrimLeft(string_view lhs, long limit) -> string& {
if(lhs.size() == 0) return *this;
long matches = 0;
while(matches < limit) {
signed offset = lhs.size() * matches;
signed length = (signed)size() - offset;
if(length < (signed)lhs.size()) break;
int offset = lhs.size() * matches;
int length = (int)size() - offset;
if(length < (int)lhs.size()) break;
if(memory::icompare(data() + offset, lhs.data(), lhs.size()) != 0) break;
matches++;
}
@@ -56,13 +56,13 @@ auto string::iltrim(rstring lhs, long limit) -> string& {
return *this;
}
auto string::irtrim(rstring rhs, long limit) -> string& {
auto string::itrimRight(string_view rhs, long limit) -> string& {
if(rhs.size() == 0) return *this;
long matches = 0;
while(matches < limit) {
signed offset = (signed)size() - rhs.size() * (matches + 1);
signed length = (signed)size() - offset;
if(offset < 0 || length < (signed)rhs.size()) break;
int offset = (int)size() - rhs.size() * (matches + 1);
int length = (int)size() - offset;
if(offset < 0 || length < (int)rhs.size()) break;
if(memory::icompare(data() + offset, rhs.data(), rhs.size()) != 0) break;
matches++;
}
@@ -71,13 +71,13 @@ auto string::irtrim(rstring rhs, long limit) -> string& {
}
auto string::strip() -> string& {
rstrip();
lstrip();
stripRight();
stripLeft();
return *this;
}
auto string::lstrip() -> string& {
unsigned length = 0;
auto string::stripLeft() -> string& {
uint length = 0;
while(length < size()) {
char input = operator[](length);
if(input != ' ' && input != '\t' && input != '\r' && input != '\n') break;
@@ -87,8 +87,8 @@ auto string::lstrip() -> string& {
return *this;
}
auto string::rstrip() -> string& {
unsigned length = 0;
auto string::stripRight() -> string& {
uint length = 0;
while(length < size()) {
bool matched = false;
char input = operator[](size() - length - 1);