2018-12-09 23:21:22 +00:00
|
|
|
#pragma once
|
2019-01-01 20:54:57 +00:00
|
|
|
#include "ki/pclass/EnumType.h"
|
|
|
|
#include "ki/pclass/PrimitiveType.h"
|
2018-12-09 23:21:22 +00:00
|
|
|
|
|
|
|
namespace ki
|
|
|
|
{
|
|
|
|
namespace pclass
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* TODO: Documentation
|
|
|
|
*/
|
2018-12-10 21:26:34 +00:00
|
|
|
class Enum
|
2018-12-09 23:21:22 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-12-10 21:26:34 +00:00
|
|
|
explicit Enum(const Type &type, enum_value_t value = 0);
|
|
|
|
explicit Enum(const Type &type, const std::string &element_name);
|
|
|
|
Enum &operator=(const Enum &that);
|
2018-12-09 23:21:22 +00:00
|
|
|
|
|
|
|
const EnumType &get_type() const;
|
|
|
|
|
2018-12-10 21:26:34 +00:00
|
|
|
enum_value_t get_value() const;
|
|
|
|
void set_value(enum_value_t value);
|
|
|
|
void set_value(const std::string &element_name);
|
2018-12-09 23:21:22 +00:00
|
|
|
|
2018-12-10 21:26:34 +00:00
|
|
|
void write_to(BitStream& stream) const;
|
|
|
|
void read_from(BitStream& stream);
|
2018-12-09 23:21:22 +00:00
|
|
|
|
2018-12-10 21:26:34 +00:00
|
|
|
operator enum_value_t() const;
|
|
|
|
void operator=(enum_value_t value);
|
|
|
|
bool operator==(const enum_value_t &rhs) const;
|
2018-12-09 23:21:22 +00:00
|
|
|
|
2018-12-10 21:26:34 +00:00
|
|
|
operator std::string() const;
|
|
|
|
void operator=(const std::string &element_name);
|
|
|
|
bool operator==(const std::string &rhs) const;
|
2018-12-09 23:21:22 +00:00
|
|
|
|
2018-12-10 21:26:34 +00:00
|
|
|
bool operator==(const Enum &rhs) const;
|
|
|
|
bool operator!=(const Enum &rhs) const;
|
2018-12-09 23:21:22 +00:00
|
|
|
|
2018-12-10 21:26:34 +00:00
|
|
|
private:
|
|
|
|
enum_value_t m_value;
|
|
|
|
const EnumType *m_type;
|
2018-12-09 23:21:22 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|