-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanager.hpp
More file actions
41 lines (30 loc) · 935 Bytes
/
manager.hpp
File metadata and controls
41 lines (30 loc) · 935 Bytes
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
#pragma once
#include <string>
#include <unordered_map>
#include "map_iterator.hpp"
namespace pass_manager {
struct Record {
Record(const std::string& name,
const std::string& login,
const std::string& pass);
void dump(std::ostream&) const;
static Record load(std::istream&);
const std::string name;
const std::string login;
const std::string pass;
};
std::ostream& operator<<(std::ostream& stream, const Record& record);
class Manager {
typedef std::unordered_map<std::string, const Record> Relations;
public:
typedef map_iterator<Relations::const_iterator> RelationsIterator;
void add_record(const Record& record);
bool has_record(const std::string& name) const;
const Record& find(const std::string& name) const;
std::size_t size() const;
RelationsIterator begin() const;
RelationsIterator end() const;
private:
Relations relations_;
};
}