using boost uuid
This commit is contained in:
parent
60365877d6
commit
0104e72997
3 changed files with 14 additions and 4 deletions
|
@ -1,4 +1,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
find_package(Boost 1.62 REQUIRED)
|
||||||
|
|
||||||
set(CORE_HEADERS
|
set(CORE_HEADERS
|
||||||
entity.h
|
entity.h
|
||||||
)
|
)
|
||||||
|
@ -7,3 +10,4 @@ set(CORE_SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(core STATIC ${CORE_SOURCES})
|
add_library(core STATIC ${CORE_SOURCES})
|
||||||
|
target_link_libraries(core Boost::boost)
|
|
@ -1,6 +1,7 @@
|
||||||
#include "entity.h"
|
#include "entity.h"
|
||||||
|
|
||||||
Entity::Entity()
|
#include <boost/uuid/uuid_generators.hpp>
|
||||||
{
|
|
||||||
|
|
||||||
|
Entity::Entity() : uuid(boost::uuids::random_generator()())
|
||||||
|
{
|
||||||
}
|
}
|
|
@ -1,13 +1,18 @@
|
||||||
#ifndef ENTITY_H
|
#ifndef ENTITY_H
|
||||||
#define ENTITY_H
|
#define ENTITY_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <boost/uuid/uuid.hpp>
|
||||||
|
|
||||||
class Entity
|
class Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Entity();
|
Entity();
|
||||||
~Entity();
|
~Entity();
|
||||||
|
const boost::uuids::uuid& getUuid() {return uuid;};
|
||||||
private:
|
private:
|
||||||
int uuid{-1};
|
boost::uuids::uuid uuid;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //ENTITY_H
|
#endif //ENTITY_H
|
Loading…
Reference in a new issue