diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2020-03-18 22:53:40 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2020-03-23 21:37:30 +0100 |
commit | 627d135bf5108f514161e1d37acf6b97c4b3c4a3 (patch) | |
tree | 601b2560bb484aedbe51f25a6da3beeae62a78fc /include | |
parent | 29ade9784fe65ecd686b5e8e18d84e6acc30b37a (diff) |
Move UUID and time definitions to separate modules
Diffstat (limited to 'include')
-rw-r--r-- | include/erebos/message.h | 2 | ||||
-rw-r--r-- | include/erebos/service.h | 6 | ||||
-rw-r--r-- | include/erebos/storage.h | 29 | ||||
-rw-r--r-- | include/erebos/time.h | 20 | ||||
-rw-r--r-- | include/erebos/uuid.h | 20 |
5 files changed, 48 insertions, 29 deletions
diff --git a/include/erebos/message.h b/include/erebos/message.h index 6415f92..0b5e257 100644 --- a/include/erebos/message.h +++ b/include/erebos/message.h @@ -15,7 +15,7 @@ class DirectMessage { public: const Identity & from() const; - const ZonedTime & time() const; + const struct ZonedTime & time() const; const std::string & text() const; private: diff --git a/include/erebos/service.h b/include/erebos/service.h index 7a6f646..2d6fbce 100644 --- a/include/erebos/service.h +++ b/include/erebos/service.h @@ -1,6 +1,8 @@ #pragma once -#include <erebos/storage.h> +#include <erebos/uuid.h> + +#include <memory> namespace erebos { @@ -17,7 +19,7 @@ public: Context(Priv *); Priv & priv(); - const Ref & ref() const; + const class Ref & ref() const; const class Peer & peer() const; private: diff --git a/include/erebos/storage.h b/include/erebos/storage.h index 4d7c691..d5ae45a 100644 --- a/include/erebos/storage.h +++ b/include/erebos/storage.h @@ -1,8 +1,10 @@ #pragma once +#include <erebos/time.h> +#include <erebos/uuid.h> + #include <algorithm> #include <array> -#include <chrono> #include <cstring> #include <filesystem> #include <memory> @@ -11,8 +13,6 @@ #include <variant> #include <vector> -#include <uuid/uuid.h> - namespace erebos { class Storage; @@ -162,29 +162,6 @@ protected: Ref(const std::shared_ptr<const Priv> p): PartialRef(p) {} }; -struct ZonedTime -{ - explicit ZonedTime(std::string); - ZonedTime(std::chrono::system_clock::time_point t): time(t), zone(0) {} - explicit operator std::string() const; - - static ZonedTime now(); - - std::chrono::system_clock::time_point time; - std::chrono::minutes zone; // zone offset -}; - -struct UUID -{ - explicit UUID(std::string); - explicit operator std::string() const; - - bool operator==(const UUID &) const; - bool operator!=(const UUID &) const; - - uuid_t uuid; -}; - template<class S> class RecordT { diff --git a/include/erebos/time.h b/include/erebos/time.h new file mode 100644 index 0000000..d8ff5b1 --- /dev/null +++ b/include/erebos/time.h @@ -0,0 +1,20 @@ +#pragma once + +#include <chrono> +#include <string> + +namespace erebos { + +struct ZonedTime +{ + explicit ZonedTime(std::string); + ZonedTime(std::chrono::system_clock::time_point t): time(t), zone(0) {} + explicit operator std::string() const; + + static ZonedTime now(); + + std::chrono::system_clock::time_point time; + std::chrono::minutes zone; // zone offset +}; + +} diff --git a/include/erebos/uuid.h b/include/erebos/uuid.h new file mode 100644 index 0000000..31322ea --- /dev/null +++ b/include/erebos/uuid.h @@ -0,0 +1,20 @@ +#pragma once + +#include <uuid/uuid.h> + +#include <string> + +namespace erebos { + +struct UUID +{ + explicit UUID(std::string); + explicit operator std::string() const; + + bool operator==(const UUID &) const; + bool operator!=(const UUID &) const; + + uuid_t uuid; +}; + +} |