Tramway SDK
uid.h
Go to the documentation of this file.
1// TRAMWAY DRIFT AND DUNGEON EXPLORATION SIMULATOR 2022
2// All rights reserved.
3
4#ifndef TRAM_SDK_FRAMEWORK_UID_H
5#define TRAM_SDK_FRAMEWORK_UID_H
6
7#include <string>
8
9namespace tram {
10
11struct UID {
12 UID() {}
13 UID(const UID& value) { *this = value; }
14 ~UID() {}
15
16 UID(const std::string& value);
17 UID(const char* value);
18
19 UID& operator=(const UID& value) {
20 key = value.key;
21 return *this;
22 }
23
24 bool operator==(const UID& other) const {
25 return key == other.key;
26 }
27
28 bool operator==(const char* other) const {
29 return key == UID(other).key;
30 }
31
32 explicit operator bool() { return key; }
33
34 operator std::string() const;
35 operator char const*() const;
36
37 uint32_t key = 0;
38};
39
40typedef UID name_t;
41
42}
43
44#endif // TRAM_SDK_FRAMEWORK_UID_H
Definition: api.h:9
UID name_t
Definition: uid.h:40
Definition: uid.h:11
bool operator==(const UID &other) const
Definition: uid.h:24
bool operator==(const char *other) const
Definition: uid.h:28
~UID()
Definition: uid.h:14
UID(const UID &value)
Definition: uid.h:13
uint32_t key
Definition: uid.h:37
UID()
Definition: uid.h:12
UID & operator=(const UID &value)
Definition: uid.h:19