mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-16 15:24:14 +02:00
Update to v094r37 release.
byuu says: Changelog: - synchronizes lots of nall changes - changes displayed program title from tomoko to higan(*) - browser dialog sort is case-insensitive - .sys folders look at user-selected library path; no longer hard-coded Tried to get rid of the file modes from the Windows browser dialog, but it was being a bitch so I left it on for now. - The storage locations and binary still use tomoko. I'm not really sure what to do here. The idea is there may be more than one "higan" UI in the future, but I don't want people to go around calling the entire program by the UI name. For official Windows releases, I can rename the binaries to "higan-{profile}.exe", and by putting the config files with the binary, they won't ever see the tomoko folder. Linux is of course trickier. Note: Windows users will need to edit hiro/components.hpp and comment out these lines: #define Hiro_Console #define Hiro_IconView #define Hiro_SourceView #define Hiro_TreeView I forgot to do that, and too lazy to upload another WIP.
This commit is contained in:
@@ -2,69 +2,92 @@
|
||||
|
||||
namespace nall {
|
||||
|
||||
auto trim(string& self, rstring lhs, rstring rhs) -> bool {
|
||||
if(lhs.size() + rhs.size() > self.size()) return false;
|
||||
if(memory::compare(self.data(), lhs.data(), lhs.size()) != 0) return false;
|
||||
if(memory::compare(self.data() + self.size() - rhs.size(), rhs.data(), rhs.size()) != 0) return false;
|
||||
self.resize(self.size() - rhs.size());
|
||||
self.remove(0, lhs.size());
|
||||
return true;
|
||||
auto trim(string& self, rstring lhs, rstring rhs, long limit) -> string& {
|
||||
rtrim(self, rhs, limit);
|
||||
ltrim(self, lhs, limit);
|
||||
return self;
|
||||
}
|
||||
|
||||
auto ltrim(string& self, rstring lhs) -> bool {
|
||||
if(lhs.size() > self.size()) return false;
|
||||
if(memory::compare(self.data(), lhs.data(), lhs.size()) != 0) return false;
|
||||
self.remove(0, lhs.size());
|
||||
return true;
|
||||
auto ltrim(string& self, rstring lhs, long limit) -> string& {
|
||||
if(lhs.size() == 0) return self;
|
||||
long matches = 0;
|
||||
while(matches < limit) {
|
||||
signed offset = lhs.size() * matches;
|
||||
signed size = (signed)self.size() - offset;
|
||||
if(size < (signed)lhs.size()) break;
|
||||
if(memory::compare(self.data() + offset, lhs.data(), lhs.size()) != 0) break;
|
||||
matches++;
|
||||
}
|
||||
if(matches) self.remove(0, lhs.size() * matches);
|
||||
return self;
|
||||
}
|
||||
|
||||
auto rtrim(string& self, rstring rhs) -> bool {
|
||||
if(rhs.size() > self.size()) return false;
|
||||
if(memory::compare(self.data() + self.size() - rhs.size(), rhs.data(), rhs.size()) != 0) return false;
|
||||
self.resize(self.size() - rhs.size());
|
||||
return true;
|
||||
auto rtrim(string& self, rstring rhs, long limit) -> string& {
|
||||
if(rhs.size() == 0) return self;
|
||||
long matches = 0;
|
||||
while(matches < limit) {
|
||||
signed offset = (signed)self.size() - rhs.size() * (matches + 1);
|
||||
signed size = (signed)self.size() - offset;
|
||||
if(offset < 0 || size < (signed)rhs.size()) break;
|
||||
if(memory::compare(self.data() + offset, rhs.data(), rhs.size()) != 0) break;
|
||||
matches++;
|
||||
}
|
||||
if(matches) self.resize(self.size() - rhs.size() * matches);
|
||||
return self;
|
||||
}
|
||||
|
||||
auto itrim(string& self, rstring lhs, rstring rhs) -> bool {
|
||||
if(lhs.size() + rhs.size() > self.size()) return false;
|
||||
if(memory::icompare(self.data(), lhs.data(), lhs.size()) != 0) return false;
|
||||
if(memory::icompare(self.data() + self.size() - rhs.size(), rhs.data(), rhs.size()) != 0) return false;
|
||||
self.resize(self.size() - rhs.size());
|
||||
self.remove(0, lhs.size());
|
||||
return true;
|
||||
auto itrim(string& self, rstring lhs, rstring rhs, long limit) -> string& {
|
||||
irtrim(self, rhs, limit);
|
||||
iltrim(self, lhs, limit);
|
||||
return self;
|
||||
}
|
||||
|
||||
auto iltrim(string& self, rstring lhs) -> bool {
|
||||
if(lhs.size() > self.size()) return false;
|
||||
if(memory::icompare(self.data(), lhs.data(), lhs.size()) != 0) return false;
|
||||
self.remove(0, lhs.size());
|
||||
return true;
|
||||
auto iltrim(string& self, rstring lhs, long limit) -> string& {
|
||||
if(lhs.size() == 0) return self;
|
||||
long matches = 0;
|
||||
while(matches < limit) {
|
||||
signed offset = lhs.size() * matches;
|
||||
signed size = (signed)self.size() - offset;
|
||||
if(size < (signed)lhs.size()) break;
|
||||
if(memory::icompare(self.data() + offset, lhs.data(), lhs.size()) != 0) break;
|
||||
matches++;
|
||||
}
|
||||
if(matches) self.remove(0, lhs.size() * matches);
|
||||
return self;
|
||||
}
|
||||
|
||||
auto irtrim(string& self, rstring rhs) -> bool {
|
||||
if(rhs.size() > self.size()) return false;
|
||||
if(memory::icompare(self.data() + self.size() - rhs.size(), rhs.data(), rhs.size()) != 0) return false;
|
||||
self.resize(self.size() - rhs.size());
|
||||
return true;
|
||||
auto irtrim(string& self, rstring rhs, long limit) -> string& {
|
||||
if(rhs.size() == 0) return self;
|
||||
long matches = 0;
|
||||
while(matches < limit) {
|
||||
signed offset = (signed)self.size() - rhs.size() * (matches + 1);
|
||||
signed size = (signed)self.size() - offset;
|
||||
if(offset < 0 || size < (signed)rhs.size()) break;
|
||||
if(memory::icompare(self.data() + offset, rhs.data(), rhs.size()) != 0) break;
|
||||
matches++;
|
||||
}
|
||||
if(matches) self.resize(self.size() - rhs.size() * matches);
|
||||
return self;
|
||||
}
|
||||
|
||||
auto strip(string& self) -> bool {
|
||||
return rstrip(self) | lstrip(self);
|
||||
auto strip(string& self) -> string& {
|
||||
rstrip(self);
|
||||
lstrip(self);
|
||||
return self;
|
||||
}
|
||||
|
||||
auto lstrip(string& self) -> bool {
|
||||
auto lstrip(string& self) -> string& {
|
||||
unsigned size = 0;
|
||||
while(size < self.size()) {
|
||||
char input = self[size];
|
||||
if(input != ' ' && input != '\t' && input != '\r' && input != '\n') break;
|
||||
size++;
|
||||
}
|
||||
if(size == 0) return false;
|
||||
self.remove(0, size);
|
||||
return true;
|
||||
if(size) self.remove(0, size);
|
||||
return self;
|
||||
}
|
||||
|
||||
auto rstrip(string& self) -> bool {
|
||||
auto rstrip(string& self) -> string& {
|
||||
unsigned size = 0;
|
||||
while(size < self.size()) {
|
||||
bool matched = false;
|
||||
@@ -72,9 +95,8 @@ auto rstrip(string& self) -> bool {
|
||||
if(input != ' ' && input != '\t' && input != '\r' && input != '\n') break;
|
||||
size++;
|
||||
}
|
||||
if(size == 0) return false;
|
||||
self.resize(self.size() - size);
|
||||
return true;
|
||||
if(size) self.resize(self.size() - size);
|
||||
return self;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user