2016-05-07 20:38:52 +02:00
|
|
|
#pragma once
|
2016-07-21 00:00:31 +02:00
|
|
|
|
|
|
|
#include "types.h"
|
2016-05-07 20:38:52 +02:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace utils
|
|
|
|
{
|
2016-07-21 00:00:31 +02:00
|
|
|
enum class version_type : uint
|
2016-05-07 20:38:52 +02:00
|
|
|
{
|
|
|
|
pre_alpha,
|
|
|
|
alpha,
|
|
|
|
beta,
|
|
|
|
release_candidate,
|
|
|
|
release
|
|
|
|
};
|
|
|
|
|
|
|
|
std::string to_string(version_type type);
|
|
|
|
|
|
|
|
class version
|
|
|
|
{
|
2016-07-21 00:00:31 +02:00
|
|
|
uint m_hi;
|
|
|
|
uint m_mid;
|
|
|
|
uint m_lo;
|
2016-05-07 20:38:52 +02:00
|
|
|
version_type m_type = version_type::release;
|
2016-07-21 00:00:31 +02:00
|
|
|
uint m_type_index = 1;
|
|
|
|
const char* m_postfix;
|
2016-05-07 20:38:52 +02:00
|
|
|
|
|
|
|
public:
|
2016-07-21 00:00:31 +02:00
|
|
|
constexpr version(uint hi, uint mid, uint lo, version_type type, uint type_index, const char* postfix)
|
|
|
|
: m_hi(hi)
|
|
|
|
, m_mid(mid)
|
|
|
|
, m_lo(lo)
|
|
|
|
, m_type(type)
|
|
|
|
, m_type_index(type_index)
|
|
|
|
, m_postfix(postfix)
|
|
|
|
{
|
|
|
|
}
|
2016-05-07 20:38:52 +02:00
|
|
|
|
2016-07-21 00:00:31 +02:00
|
|
|
uint hi() const
|
2016-05-07 20:38:52 +02:00
|
|
|
{
|
|
|
|
return m_hi;
|
|
|
|
}
|
|
|
|
|
2016-07-21 00:00:31 +02:00
|
|
|
uint mid() const
|
2016-05-07 20:38:52 +02:00
|
|
|
{
|
|
|
|
return m_mid;
|
|
|
|
}
|
|
|
|
|
2016-07-21 00:00:31 +02:00
|
|
|
uint lo() const
|
2016-05-07 20:38:52 +02:00
|
|
|
{
|
|
|
|
return m_lo;
|
|
|
|
}
|
|
|
|
|
|
|
|
version_type type() const
|
|
|
|
{
|
|
|
|
return m_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string postfix() const
|
|
|
|
{
|
|
|
|
return m_postfix;
|
|
|
|
}
|
|
|
|
|
2016-07-21 00:00:31 +02:00
|
|
|
uint type_index() const
|
2016-05-07 20:38:52 +02:00
|
|
|
{
|
|
|
|
return m_type_index;
|
|
|
|
}
|
|
|
|
|
2016-07-21 00:00:31 +02:00
|
|
|
uint to_hex() const;
|
2016-05-07 20:38:52 +02:00
|
|
|
std::string to_string() const;
|
|
|
|
};
|
|
|
|
}
|