EHS/include/Type.h

55 lines
980 B
C
Raw Normal View History

2023-12-17 03:29:08 -08:00
#pragma once
2023-12-18 02:13:20 -08:00
#include "Types.h"
#include "Util.h"
2023-12-17 03:29:08 -08:00
2023-12-17 15:56:13 -08:00
namespace ehs
2023-12-17 03:29:08 -08:00
{
class Type
{
private:
2023-12-18 02:13:20 -08:00
friend class BaseObj;
UInt_64 size;
const Char_8* id;
2023-12-17 03:29:08 -08:00
UInt_64 hashId;
public:
Type();
2023-12-18 02:13:20 -08:00
explicit Type(const Char_8* id);
2023-12-17 03:29:08 -08:00
2023-12-18 02:13:20 -08:00
Type(Type&& type) noexcept = default;
2023-12-17 03:29:08 -08:00
2023-12-18 02:13:20 -08:00
Type(const Type& type) = default;
2023-12-17 03:29:08 -08:00
2023-12-18 02:13:20 -08:00
Type& operator=(Type&& type) noexcept = default;
2023-12-17 03:29:08 -08:00
2023-12-18 02:13:20 -08:00
Type& operator=(const Type& type) = default;
2023-12-17 03:29:08 -08:00
bool operator==(const Type& type) const;
bool operator!=(const Type& type) const;
2023-12-18 02:13:20 -08:00
bool operator==(UInt_64 inHashId) const;
2023-12-17 03:29:08 -08:00
2023-12-18 02:13:20 -08:00
bool operator!=(UInt_64 inHashId) const;
2023-12-17 03:29:08 -08:00
2023-12-18 02:13:20 -08:00
bool operator==(const Char_8* inStr) const;
2023-12-17 03:29:08 -08:00
2023-12-18 02:13:20 -08:00
bool operator!=(const Char_8* inStr) const;
2023-12-17 03:29:08 -08:00
2023-12-18 02:13:20 -08:00
UInt_64 GetSize() const;
2023-12-17 03:29:08 -08:00
2023-12-18 02:13:20 -08:00
const Char_8* GetId() const;
UInt_64 GetHashId() const;
2023-12-17 03:29:08 -08:00
bool IsValid() const;
2023-12-18 02:13:20 -08:00
private:
static UInt_64 CalcSize(const Char_8* id);
static UInt_64 GenHash(const Char_8* id, UInt_64 size);
2023-12-17 03:29:08 -08:00
};
}