COMMON: Remove rawString member for Common::Path

This commit is contained in:
Vladimir Serbinenko 2022-12-09 21:03:10 +01:00
parent f3daf65116
commit 673e5e025b
2 changed files with 10 additions and 16 deletions

View file

@ -29,7 +29,7 @@ const char DIR_SEPARATOR = '\x1f'; // unit separator
namespace Common { namespace Common {
Path::Path(const Path &path) { Path::Path(const Path &path) {
_str = path.rawString(); _str = path._str;
} }
Path::Path(const char *str, char separator) { Path::Path(const char *str, char separator) {
@ -83,11 +83,11 @@ Path Path::appendComponent(const String &x) const {
} }
bool Path::operator==(const Path &x) const { bool Path::operator==(const Path &x) const {
return _str == x.rawString(); return _str == x._str;
} }
bool Path::operator!=(const Path &x) const { bool Path::operator!=(const Path &x) const {
return _str != x.rawString(); return _str != x._str;
} }
bool Path::empty() const { bool Path::empty() const {
@ -95,7 +95,7 @@ bool Path::empty() const {
} }
Path &Path::operator=(const Path &path) { Path &Path::operator=(const Path &path) {
_str = path.rawString(); _str = path._str;
return *this; return *this;
} }
@ -115,7 +115,7 @@ void Path::set(const char *str, char separator) {
} }
Path &Path::appendInPlace(const Path &x) { Path &Path::appendInPlace(const Path &x) {
_str += x.rawString(); _str += x._str;
return *this; return *this;
} }
@ -157,10 +157,10 @@ Path &Path::joinInPlace(const Path &x) {
if (x.empty()) if (x.empty())
return *this; return *this;
if (!_str.empty() && _str.lastChar() != DIR_SEPARATOR && x.rawString().firstChar() != DIR_SEPARATOR) if (!_str.empty() && _str.lastChar() != DIR_SEPARATOR && x._str.firstChar() != DIR_SEPARATOR)
_str += DIR_SEPARATOR; _str += DIR_SEPARATOR;
_str += x.rawString(); _str += x._str;
return *this; return *this;
} }
@ -198,7 +198,7 @@ Path Path::join(const char *str, char separator) const {
} }
Path Path::punycodeDecode() const { Path Path::punycodeDecode() const {
StringTokenizer tok(rawString(), String(DIR_SEPARATOR)); StringTokenizer tok(_str, String(DIR_SEPARATOR));
String res; String res;
while (!tok.empty()) { while (!tok.empty()) {
@ -211,7 +211,7 @@ Path Path::punycodeDecode() const {
} }
String Path::getIdentifierString() const { String Path::getIdentifierString() const {
StringTokenizer tok(rawString(), String(DIR_SEPARATOR)); StringTokenizer tok(_str, String(DIR_SEPARATOR));
String res; String res;
while (!tok.empty()) { while (!tok.empty()) {
@ -229,7 +229,7 @@ String Path::getIdentifierString() const {
} }
Path Path::punycodeEncode() const { Path Path::punycodeEncode() const {
StringTokenizer tok(rawString(), String(DIR_SEPARATOR)); StringTokenizer tok(_str, String(DIR_SEPARATOR));
String res; String res;
while (!tok.empty()) { while (!tok.empty()) {

View file

@ -93,12 +93,6 @@ public:
*/ */
Path(const String &str, char separator = '/'); Path(const String &str, char separator = '/');
/**
* Returns the unmodified, internal representation of the path,
* using '\x1f' as a directory separator.
*/
const String &rawString() const { return _str; }
/** /**
* Converts a path to a string using the given directory separator. * Converts a path to a string using the given directory separator.
* *