|
0
|
1 |
#ifndef VMAILMGR__VPWTABLE__H__
|
|
|
2 |
#define VMAILMGR__VPWTABLE__H__
|
|
|
3 |
|
|
|
4 |
#include "mystring/mystring.h"
|
|
|
5 |
#include "misc/strlist.h"
|
|
|
6 |
#include "vpwentry/vpwentry.h"
|
|
|
7 |
|
|
|
8 |
class vdomain;
|
|
|
9 |
|
|
|
10 |
class vpwtable_reader
|
|
|
11 |
{
|
|
|
12 |
public:
|
|
|
13 |
virtual ~vpwtable_reader();
|
|
|
14 |
virtual bool operator!() const = 0;
|
|
2
|
15 |
virtual vpwentry* get() = 0;
|
|
0
|
16 |
virtual bool rewind() = 0;
|
|
|
17 |
virtual bool end() = 0;
|
|
|
18 |
};
|
|
|
19 |
|
|
2
|
20 |
class vpwtable_writer
|
|
|
21 |
{
|
|
|
22 |
public:
|
|
|
23 |
virtual ~vpwtable_writer();
|
|
|
24 |
virtual bool operator!() const = 0;
|
|
|
25 |
virtual bool put(const vpwentry& vpw) = 0;
|
|
|
26 |
virtual bool end() = 0;
|
|
|
27 |
virtual bool abort() = 0;
|
|
|
28 |
};
|
|
|
29 |
|
|
0
|
30 |
class vpwtable
|
|
|
31 |
{
|
|
|
32 |
private:
|
|
|
33 |
const mystring filename;
|
|
|
34 |
vpwtable(); // Unimplemented on purpose
|
|
|
35 |
public:
|
|
|
36 |
vpwtable(const vdomain*);
|
|
|
37 |
vpwtable(const vpwtable&);
|
|
|
38 |
~vpwtable();
|
|
|
39 |
|
|
|
40 |
vpwtable_reader* start_read() const;
|
|
2
|
41 |
vpwtable_writer* start_write() const;
|
|
|
42 |
|
|
0
|
43 |
vpwentry* getbyname(const mystring& name) const;
|
|
|
44 |
bool exists(const mystring& name) const;
|
|
|
45 |
|
|
|
46 |
bool put(const vpwentry* vpw, bool onlyadd) const;
|
|
|
47 |
|
|
|
48 |
bool del(const mystring& name) const;
|
|
|
49 |
inline bool set(const vpwentry* vpw) const
|
|
|
50 |
{
|
|
|
51 |
return put(vpw, false);
|
|
|
52 |
}
|
|
|
53 |
inline bool add(const vpwentry* vpw) const
|
|
|
54 |
{
|
|
|
55 |
return put(vpw, true);
|
|
|
56 |
}
|
|
|
57 |
};
|
|
|
58 |
|
|
|
59 |
#endif
|