diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/mmo.hpp | 2 | ||||
-rw-r--r-- | src/common/utils.cpp | 18 | ||||
-rw-r--r-- | src/common/utils.hpp | 2 |
3 files changed, 9 insertions, 13 deletions
diff --git a/src/common/mmo.hpp b/src/common/mmo.hpp index 16acb88..0e1a7d0 100644 --- a/src/common/mmo.hpp +++ b/src/common/mmo.hpp @@ -65,7 +65,7 @@ class MapName : public strings::_crtp_string<MapName, MapName, strings::ZPair> VString<15> _impl; public: MapName() = default; - MapName(VString<15> v) : _impl(v.oislice_h(std::find(v.begin(), v.end(), '.'))) {} + MapName(VString<15> v) : _impl(v.xislice_h(std::find(v.begin(), v.end(), '.'))) {} iterator begin() const { return &*_impl.begin(); } iterator end() const { return &*_impl.end(); } diff --git a/src/common/utils.cpp b/src/common/utils.cpp index 21440a4..383c711 100644 --- a/src/common/utils.cpp +++ b/src/common/utils.cpp @@ -6,8 +6,6 @@ #include <algorithm> #include "../strings/fstring.hpp" -#include "../strings/tstring.hpp" -#include "../strings/sstring.hpp" #include "../strings/zstring.hpp" #include "../strings/xstring.hpp" @@ -65,27 +63,25 @@ int config_switch(ZString str) abort(); } -bool split_key_value(const FString& line, SString *w1, TString *w2) +bool split_key_value(ZString line, XString *w1, ZString *w2) { - FString::iterator begin = line.begin(), end = line.end(); - if (line.startswith("//")) return false; - if (begin == end) + if (!line) return false; - if (std::find_if(begin, end, + if (std::find_if(line.begin(), line.end(), [](unsigned char c) { return c < ' '; } ) != line.end()) return false; - FString::iterator colon = std::find(begin, end, ':'); - if (colon == end) + ZString::iterator colon = std::find(line.begin(), line.end(), ':'); + if (colon == line.end()) return false; - *w1 = line.oislice(begin, colon); + *w1 = line.xislice_h(colon); ++colon; while (std::isspace(*colon)) ++colon; - *w2 = line.oislice(colon, end); + *w2 = line.xislice_t(colon); return true; } diff --git a/src/common/utils.hpp b/src/common/utils.hpp index 66b1654..b0ee2bc 100644 --- a/src/common/utils.hpp +++ b/src/common/utils.hpp @@ -27,7 +27,7 @@ struct is_trivially_copyable bool e_mail_check(XString email); int config_switch (ZString str); -bool split_key_value(const FString& line, SString *w1, TString *w2); +bool split_key_value(ZString line, XString *w1, ZString *w2); inline void really_memcpy(uint8_t *dest, const uint8_t *src, size_t n) |