Make a lot of one-liner functions inline
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -22,45 +22,45 @@ namespace Porygon::Utilities{
|
||||
_string(std::shared_ptr<const std::u16string>(s))
|
||||
{
|
||||
}
|
||||
static HashedString CreateLookup(const std::u16string& s){
|
||||
inline static HashedString CreateLookup(const std::u16string& s){
|
||||
return HashedString(s);
|
||||
}
|
||||
static HashedString CreateLookup(uint32_t hash){
|
||||
inline static HashedString CreateLookup(uint32_t hash){
|
||||
return HashedString(hash);
|
||||
}
|
||||
|
||||
HashedString(const HashedString& b) = default;
|
||||
|
||||
static uint32_t constexpr ConstHash(char16_t const *input) {
|
||||
inline 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) {
|
||||
inline 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{
|
||||
inline const uint32_t GetHash() const{
|
||||
return _hash;
|
||||
}
|
||||
|
||||
const std::shared_ptr<const std::u16string> GetString() const{
|
||||
inline const std::shared_ptr<const std::u16string> GetString() const{
|
||||
return _string;
|
||||
}
|
||||
|
||||
bool operator==(const HashedString& b) const{
|
||||
inline bool operator==(const HashedString& b) const{
|
||||
return _hash == b._hash;
|
||||
}
|
||||
bool operator!=(const HashedString& b) const{
|
||||
inline bool operator!=(const HashedString& b) const{
|
||||
return _hash != b._hash;
|
||||
}
|
||||
bool operator<(const HashedString& b) const{
|
||||
inline bool operator<(const HashedString& b) const{
|
||||
return _hash < b._hash;
|
||||
}
|
||||
bool operator>(const HashedString& b) const{
|
||||
inline bool operator>(const HashedString& b) const{
|
||||
return _hash > b._hash;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,17 +13,17 @@ namespace Porygon::Utilities{
|
||||
private:
|
||||
static std::wstring_convert<std::codecvt_utf8_utf16<char16_t, 0x10ffff, std::little_endian>, char16_t> to_16;
|
||||
public:
|
||||
static std::u16string IntToString(long const &i) {
|
||||
inline static std::u16string IntToString(long const &i) {
|
||||
return to_16.from_bytes(std::to_string(i));
|
||||
}
|
||||
static std::u16string ToUTF8(const std::string &s) {
|
||||
inline static std::u16string ToUTF8(const std::string &s) {
|
||||
return to_16.from_bytes(s);
|
||||
}
|
||||
static std::string FromUTF8(const std::u16string &s) {
|
||||
inline static std::string FromUTF8(const std::u16string &s) {
|
||||
return to_16.to_bytes(s);
|
||||
}
|
||||
|
||||
static int64_t ParseInteger(const std::u16string &s){
|
||||
inline static int64_t ParseInteger(const std::u16string &s){
|
||||
auto parsed = std::stol(FromUTF8(s));
|
||||
return parsed;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user