diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2021-06-05 23:10:24 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2021-06-06 21:48:46 +0200 |
commit | 6c58f1e095f7dbe1e7e1654c1807a76276a2f3f2 (patch) | |
tree | a4e083c6dca3e6567a0d7983c7c316b85316bf4c /include/erebos/contact.h | |
parent | d563500c915de2f0a652513af03f101c99715db3 (diff) |
Contact list in shared state
Diffstat (limited to 'include/erebos/contact.h')
-rw-r--r-- | include/erebos/contact.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/include/erebos/contact.h b/include/erebos/contact.h new file mode 100644 index 0000000..e56346a --- /dev/null +++ b/include/erebos/contact.h @@ -0,0 +1,47 @@ +#pragma once + +#include <erebos/identity.h> +#include <erebos/list.h> +#include <erebos/state.h> +#include <erebos/storage.h> + +#include <memory> +#include <optional> +#include <string> +#include <vector> + +namespace erebos { + +using std::optional; +using std::shared_ptr; +using std::string; +using std::vector; + +class Contact +{ +public: + Contact(const Contact &) = default; + Contact(Contact &&) = default; + Contact & operator=(const Contact &) = default; + Contact & operator=(Contact &&) = default; + + static List<Contact> prepend(const Storage &, Identity, List<Contact>); + + Identity identity() const; + optional<string> name() const; + + bool operator==(const Contact &) const; + bool operator!=(const Contact &) const; + + static List<Contact> loadList(const vector<Ref> &); + vector<Ref> refs() const; + +private: + struct Priv; + shared_ptr<Priv> p; + Contact(shared_ptr<Priv> p): p(p) {} +}; + +DECLARE_SHARED_TYPE(List<Contact>) + +} |