2024-02-25 14:46:47 +00:00
|
|
|
#pragma once
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
#include "StarArray.hpp"
|
|
|
|
#include "StarDataStream.hpp"
|
|
|
|
|
|
|
|
namespace Star {
|
|
|
|
|
|
|
|
STAR_EXCEPTION(UuidException, StarException);
|
|
|
|
|
|
|
|
size_t const UuidSize = 16;
|
|
|
|
|
|
|
|
class Uuid {
|
|
|
|
public:
|
|
|
|
Uuid();
|
|
|
|
explicit Uuid(ByteArray const& bytes);
|
|
|
|
explicit Uuid(String const& hex);
|
|
|
|
|
|
|
|
char const* ptr() const;
|
|
|
|
ByteArray bytes() const;
|
|
|
|
String hex() const;
|
|
|
|
|
|
|
|
bool operator==(Uuid const& u) const;
|
|
|
|
bool operator!=(Uuid const& u) const;
|
|
|
|
bool operator<(Uuid const& u) const;
|
|
|
|
bool operator<=(Uuid const& u) const;
|
|
|
|
bool operator>(Uuid const& u) const;
|
|
|
|
bool operator>=(Uuid const& u) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
Array<char, UuidSize> m_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct hash<Uuid> {
|
|
|
|
size_t operator()(Uuid const& u) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
DataStream& operator>>(DataStream& ds, Uuid& uuid);
|
|
|
|
DataStream& operator<<(DataStream& ds, Uuid const& uuid);
|
|
|
|
|
|
|
|
}
|