mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-09-03 03:33:16 +02:00
Update to v093r05 release.
byuu says: Library concept has been refined as per the general forum discussion.
This commit is contained in:
@@ -81,10 +81,10 @@ public:
|
||||
inline bool match(rstring) const;
|
||||
inline bool imatch(rstring) const;
|
||||
|
||||
inline bool beginswith(rstring) const;
|
||||
inline bool ibeginswith(rstring) const;
|
||||
inline bool endswith(rstring) const;
|
||||
inline bool iendswith(rstring) const;
|
||||
inline bool beginsWith(rstring) const;
|
||||
inline bool ibeginsWith(rstring) const;
|
||||
inline bool endsWith(rstring) const;
|
||||
inline bool iendsWith(rstring) const;
|
||||
|
||||
inline string slice(unsigned offset, unsigned length = ~0u) const;
|
||||
|
||||
|
@@ -39,11 +39,11 @@ inline string evaluateExpression(Node* node) {
|
||||
|
||||
inline int64_t evaluateInteger(Node* node) {
|
||||
if(node->type == Node::Type::Literal) {
|
||||
if(node->literal.beginswith("0b")) return nall::binary(node->literal);
|
||||
if(node->literal.beginswith("0o")) return nall::octal(node->literal);
|
||||
if(node->literal.beginswith("0x")) return nall::hex(node->literal);
|
||||
if(node->literal.beginswith("%")) return nall::binary(node->literal);
|
||||
if(node->literal.beginswith("$")) return nall::hex(node->literal);
|
||||
if(node->literal.beginsWith("0b")) return nall::binary(node->literal);
|
||||
if(node->literal.beginsWith("0o")) return nall::octal(node->literal);
|
||||
if(node->literal.beginsWith("0x")) return nall::hex(node->literal);
|
||||
if(node->literal.beginsWith("%")) return nall::binary(node->literal);
|
||||
if(node->literal.beginsWith("$")) return nall::hex(node->literal);
|
||||
return nall::integer(node->literal);
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@ namespace nall {
|
||||
namespace Markup {
|
||||
|
||||
inline Node Document(const string& markup) {
|
||||
if(markup.beginswith("<")) return XML::Document(markup);
|
||||
if(markup.beginsWith("<")) return XML::Document(markup);
|
||||
return BML::Document(markup);
|
||||
}
|
||||
|
||||
|
@@ -131,8 +131,8 @@ struct Node {
|
||||
vector<Node>::iterator begin() { return children.begin(); }
|
||||
vector<Node>::iterator end() { return children.end(); }
|
||||
|
||||
const vector<Node>::const_iterator begin() const { return children.begin(); }
|
||||
const vector<Node>::const_iterator end() const { return children.end(); }
|
||||
const vector<Node>::constIterator begin() const { return children.begin(); }
|
||||
const vector<Node>::constIterator end() const { return children.end(); }
|
||||
|
||||
Node() : attribute(false), level(0) {}
|
||||
|
||||
|
@@ -8,7 +8,7 @@ string activepath() {
|
||||
string result = path;
|
||||
if(result.empty()) result = ".";
|
||||
result.transform("\\", "/");
|
||||
if(result.endswith("/") == false) result.append("/");
|
||||
if(result.endsWith("/") == false) result.append("/");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ string realpath(const string& name) {
|
||||
if(::realpath(name, path)) result = path;
|
||||
if(result.empty()) result = {activepath(), name};
|
||||
result.transform("\\", "/");
|
||||
if(result.endswith("/") == false) result.append("/");
|
||||
if(result.endsWith("/") == false) result.append("/");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ string userpath() {
|
||||
result = userinfo->pw_dir;
|
||||
#endif
|
||||
if(result.empty()) result = ".";
|
||||
if(result.endswith("/") == false) result.append("/");
|
||||
if(result.endsWith("/") == false) result.append("/");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ string configpath() {
|
||||
result = {userpath(), ".config/"};
|
||||
#endif
|
||||
if(result.empty()) result = ".";
|
||||
if(result.endswith("/") == false) result.append("/");
|
||||
if(result.endsWith("/") == false) result.append("/");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ string sharedpath() {
|
||||
result = "/usr/share/";
|
||||
#endif
|
||||
if(result.empty()) result = ".";
|
||||
if(result.endswith("/") == false) result.append("/");
|
||||
if(result.endsWith("/") == false) result.append("/");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@@ -28,22 +28,22 @@ bool string::iequals(rstring source) const {
|
||||
return icompare(source) == 0;
|
||||
}
|
||||
|
||||
bool string::beginswith(rstring source) const {
|
||||
bool string::beginsWith(rstring source) const {
|
||||
if(source.size() > size()) return false;
|
||||
return memcmp(data(), source.data(), source.size()) == 0;
|
||||
}
|
||||
|
||||
bool string::ibeginswith(rstring source) const {
|
||||
bool string::ibeginsWith(rstring source) const {
|
||||
if(source.size() > size()) return false;
|
||||
return imemcmp(data(), source.data(), source.size()) == 0;
|
||||
}
|
||||
|
||||
bool string::endswith(rstring source) const {
|
||||
bool string::endsWith(rstring source) const {
|
||||
if(source.size() > size()) return false;
|
||||
return memcmp(data() + size() - source.size(), source.data(), source.size()) == 0;
|
||||
}
|
||||
|
||||
bool string::iendswith(rstring source) const {
|
||||
bool string::iendsWith(rstring source) const {
|
||||
if(source.size() > size()) return false;
|
||||
return imemcmp(data() + size() - source.size(), source.data(), source.size()) == 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user