summaryrefslogtreecommitdiff
path: root/include/erebos/contact.h
blob: e56346a1b125b0e270b6d9e6371ea2f5c91655d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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>)

}