Added namespaces to most classes, general cleanup
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2019-06-17 18:35:12 +02:00
parent 21d3329c55
commit fde102d954
66 changed files with 4301 additions and 3909 deletions

View File

@@ -4,41 +4,43 @@
#include <string>
class HashedString{
const uint32_t _hash;
public:
explicit HashedString(const std::u16string& s) : _hash(ConstHash(s.c_str())){
}
explicit HashedString(char16_t const *input) : _hash(ConstHash(input)){
}
namespace Porygon::Utilities{
class HashedString{
const uint32_t _hash;
public:
explicit HashedString(const std::u16string& s) : _hash(ConstHash(s.c_str())){
}
explicit HashedString(char16_t const *input) : _hash(ConstHash(input)){
}
explicit HashedString(char const *input) : _hash(ConstHash(input)){
}
explicit HashedString(char const *input) : _hash(ConstHash(input)){
}
HashedString(const HashedString& b) = default;
HashedString(const HashedString& b) = default;
static uint32_t constexpr ConstHash(char16_t const *input) {
return *input ?
static_cast<uint32_t>(*input) + 33 * ConstHash(input + 1) :
5381;
}
static uint32_t constexpr ConstHash(char16_t const *input) {
return *input ?
static_cast<uint32_t>(*input) + 33 * ConstHash(input + 1) :
5381;
}
static uint32_t constexpr ConstHash(char const *input) {
return *input ?
static_cast<uint32_t>(*input) + 33 * ConstHash(input + 1) :
5381;
}
static uint32_t constexpr ConstHash(char const *input) {
return *input ?
static_cast<uint32_t>(*input) + 33 * ConstHash(input + 1) :
5381;
}
const uint32_t GetHash() const{
return _hash;
}
const uint32_t GetHash() const{
return _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;
}
bool operator!=(const HashedString& b) const{
return _hash != b._hash;
}
};
}
#endif //PORYGONLANG_HASHEDSTRING_HPP