Initial work on iterators, rework of variable handling by including actual string
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2019-06-23 15:58:14 +02:00
parent 1a84661c79
commit 76b8ba3ebc
25 changed files with 185 additions and 78 deletions

View File

@@ -7,16 +7,28 @@
namespace Porygon::Utilities{
class HashedString{
const uint32_t _hash;
const std::u16string _string;
public:
explicit HashedString(const std::u16string& s) : _hash(ConstHash(s.c_str())){
explicit HashedString(const std::u16string& s)
: _hash(ConstHash(s.c_str())),
_string(s)
{
}
explicit HashedString(char16_t const *input) : _hash(ConstHash(input)){
explicit HashedString(char16_t const *input)
: _hash(ConstHash(input)),
_string(std::u16string(input))
{
}
explicit HashedString(char const *input) : _hash(ConstHash(input)){
}
HashedString(const HashedString& b) = default;
explicit HashedString(uint32_t hash) : _hash(hash){
}
HashedString(const HashedString& b) :_hash(b._hash), _string(b._string){
};
static uint32_t constexpr ConstHash(char16_t const *input) {
return *input ?
@@ -34,12 +46,24 @@ namespace Porygon::Utilities{
return _hash;
}
const std::u16string* GetString() const{
return &_string;
}
bool operator==(const HashedString& b) const{
return _hash == b._hash;
}
bool operator!=(const HashedString& b) const{
return _hash != b._hash;
}
bool operator<(const HashedString& b) const{
return _hash < b._hash;
}
bool operator>(const HashedString& b) const{
return _hash > b._hash;
}
};
}