diff -r 000000000000 -r 6f7a81934006 lib/vpwtable/vpwtable.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/vpwtable/vpwtable.h Wed Jan 16 22:39:43 2008 +0100 @@ -0,0 +1,48 @@ +#ifndef VMAILMGR__VPWTABLE__H__ +#define VMAILMGR__VPWTABLE__H__ + +#include "mystring/mystring.h" +#include "misc/strlist.h" +#include "vpwentry/vpwentry.h" + +class vdomain; + +class vpwtable_reader +{ +public: + virtual ~vpwtable_reader(); + virtual bool operator!() const = 0; + virtual bool get(vpwentry& out) = 0; + virtual bool rewind() = 0; + virtual bool end() = 0; +}; + +class vpwtable +{ +private: + const mystring filename; + vpwtable(); // Unimplemented on purpose +public: + vpwtable(const vdomain*); + vpwtable(const vpwtable&); + ~vpwtable(); + + vpwtable_reader* start_read() const; + + vpwentry* getbyname(const mystring& name) const; + bool exists(const mystring& name) const; + + bool put(const vpwentry* vpw, bool onlyadd) const; + + bool del(const mystring& name) const; + inline bool set(const vpwentry* vpw) const + { + return put(vpw, false); + } + inline bool add(const vpwentry* vpw) const + { + return put(vpw, true); + } +}; + +#endif