Mineserver
A rewrite of Minecraft 1.8.9 in C++ !
Loading...
Searching...
No Matches
uuid.h
Go to the documentation of this file.
1
12#ifndef MINESERVER_UUID_H
13#define MINESERVER_UUID_H
14
15#include <cstdint>
16#include <string>
17#include <array>
18#include <plugins/luaheaders.h>
19
27{
28private:
29 std::array<std::byte, 16> bytes;
30 MinecraftUUID(const std::array<std::byte, 16> &bytes) : bytes(bytes) {}
31
32public:
39
47 bool operator==(const MinecraftUUID &other);
48
58 std::string getFull() const;
68 std::string getTrimmed() const;
74 const std::byte *getBytes() const;
75
81 static MinecraftUUID newRandom();
93 static MinecraftUUID fromUsername(const std::string &name);
102 static MinecraftUUID fromHex(const std::string &hexString);
109 static MinecraftUUID fromBytes(const std::byte *buff);
110
117 static void loadLua(lua_State *state, const char *namespaceName);
118};
119
120#endif // MINESERVER_UUID_H
MinecraftUUID compliant data holder.
Definition uuid.h:27
static MinecraftUUID newRandom()
Constructs a new random MinecraftUUID.
Definition uuid.cpp:74
static MinecraftUUID fromUsername(const std::string &name)
Constructs an MinecraftUUID from an username.
Definition uuid.cpp:80
bool operator==(const MinecraftUUID &other)
Equality operator.
Definition uuid.cpp:25
std::string getTrimmed() const
Get the hex of the MinecraftUUID without hyphens.
Definition uuid.cpp:62
static MinecraftUUID fromHex(const std::string &hexString)
Contructs an MinecraftUUID from an hex string.
Definition uuid.cpp:131
std::string getFull() const
Get the hex of the MinecraftUUID with hyphens.
Definition uuid.cpp:30
static void loadLua(lua_State *state, const char *namespaceName)
Loads MinecraftUUID to the lua state.
Definition uuid.cpp:173
const std::byte * getBytes() const
Get the raw bytes of the MinecraftUUID.
Definition uuid.cpp:69
static MinecraftUUID fromBytes(const std::byte *buff)
Constructs an MinecraftUUID from the raw bytes.
Definition uuid.cpp:166
MinecraftUUID()
Construct a new MinecraftUUID object.
Definition uuid.cpp:19
constexpr std::string_view type_name()
Gets the name of the type paramater.
Definition event.h:56
Utility header file for lua things.