From 4fdbc268a5e7c1bd470a6d03d8ce4f3b4ce6aaf6 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Wed, 11 Jul 2018 15:59:08 +0200 Subject: [PATCH] more on states --- src/core/entity.cpp | 2 +- src/core/entity.h | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/entity.cpp b/src/core/entity.cpp index c2a0313..6a6e5d8 100644 --- a/src/core/entity.cpp +++ b/src/core/entity.cpp @@ -19,7 +19,7 @@ void Entity::createUuidFromString(const std::string& uuidString) uuid_ = generator(uuidString); } -inline Entity::State Entity::getState() +inline Entity::State Entity::getState() const { return state_; } \ No newline at end of file diff --git a/src/core/entity.h b/src/core/entity.h index d67cc73..786d393 100644 --- a/src/core/entity.h +++ b/src/core/entity.h @@ -4,17 +4,19 @@ #include #include +#include class Entity { public: - enum class State { NEW, UPDATED, READ }; - // Entity(); + enum class State { NEW, UPDATED, CLEAN }; + virtual ~Entity() = 0; const boost::uuids::uuid& getUuid() const { return uuid_; }; void createUuid(); void createUuidFromString(const std::string& uuidString); - State getState(); + virtual State getState() const; + void setState(State state) { state_ = state; } private: boost::uuids::uuid uuid_{};