mirror of
https://github.com/whoahq/whoa.git
synced 2026-11-27 08:13:50 +03:00
chore(util): restructure guid code and add WOWGUID typedef
This commit is contained in:
19 files changed
+90
-65
No files matched your search
@@ -1,5 +1,6 @@
|
||||
file(GLOB PRIVATE_SOURCES
|
||||
"*.cpp"
|
||||
"guid/*.cpp"
|
||||
)
|
||||
|
||||
if(WHOA_SYSTEM_MAC)
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef UTIL_GUID_HPP
|
||||
#define UTIL_GUID_HPP
|
||||
|
||||
#include "util/guid/CHashKeyGUID.hpp"
|
||||
#include "util/guid/SmartGUID.hpp"
|
||||
#include "util/guid/Types.hpp"
|
||||
|
||||
#endif
|
||||
@@ -1,17 +0,0 @@
|
||||
#ifndef UTIL_SMART_GUID_HPP
|
||||
#define UTIL_SMART_GUID_HPP
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class CDataStore;
|
||||
|
||||
struct SmartGUID {
|
||||
uint64_t guid;
|
||||
|
||||
operator uint64_t() const;
|
||||
SmartGUID& operator=(uint64_t value);
|
||||
};
|
||||
|
||||
CDataStore& operator>>(CDataStore& msg, SmartGUID& guid);
|
||||
|
||||
#endif
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "util/CHashKeyGUID.hpp"
|
||||
#include "util/guid/CHashKeyGUID.hpp"
|
||||
|
||||
CHashKeyGUID::CHashKeyGUID() {
|
||||
this->m_guid = 0;
|
||||
}
|
||||
|
||||
CHashKeyGUID::CHashKeyGUID(uint64_t guid) {
|
||||
CHashKeyGUID::CHashKeyGUID(WOWGUID guid) {
|
||||
this->m_guid = guid;
|
||||
}
|
||||
@@ -1,17 +1,18 @@
|
||||
#ifndef UTIL_C_HASH_KEY_GUID_HPP
|
||||
#define UTIL_C_HASH_KEY_GUID_HPP
|
||||
#ifndef UTIL_GUID_C_HASH_KEY_GUID_HPP
|
||||
#define UTIL_GUID_C_HASH_KEY_GUID_HPP
|
||||
|
||||
#include "util/guid/Types.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
class CHashKeyGUID {
|
||||
public:
|
||||
// Public member functions
|
||||
CHashKeyGUID();
|
||||
CHashKeyGUID(uint64_t guid);
|
||||
CHashKeyGUID(WOWGUID guid);
|
||||
|
||||
private:
|
||||
// Private member variables
|
||||
uint64_t m_guid;
|
||||
WOWGUID m_guid;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "util/SmartGUID.hpp"
|
||||
#include "util/guid/SmartGUID.hpp"
|
||||
#include <common/DataStore.hpp>
|
||||
|
||||
SmartGUID::operator uint64_t() const {
|
||||
SmartGUID::operator WOWGUID() const {
|
||||
return this->guid;
|
||||
}
|
||||
|
||||
SmartGUID& SmartGUID::operator=(uint64_t guid) {
|
||||
SmartGUID& SmartGUID::operator=(WOWGUID guid) {
|
||||
this->guid = guid;
|
||||
return *this;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef UTIL_GUID_SMART_GUID_HPP
|
||||
#define UTIL_GUID_SMART_GUID_HPP
|
||||
|
||||
#include "util/guid/Types.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
class CDataStore;
|
||||
|
||||
struct SmartGUID {
|
||||
WOWGUID guid;
|
||||
|
||||
operator WOWGUID() const;
|
||||
SmartGUID& operator=(WOWGUID value);
|
||||
};
|
||||
|
||||
CDataStore& operator>>(CDataStore& msg, SmartGUID& guid);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef UTIL_GUID_TYPES_HPP
|
||||
#define UTIL_GUID_TYPES_HPP
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
typedef uint64_t WOWGUID;
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user