lib/vpwtable/vpwtable.h
changeset 0 6f7a81934006
child 2 b3afb9f1e801
equal deleted inserted replaced
-1:000000000000 0:6f7a81934006
       
     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;
       
    15   virtual bool get(vpwentry& out) = 0;
       
    16   virtual bool rewind() = 0;
       
    17   virtual bool end() = 0;
       
    18 };
       
    19 
       
    20 class vpwtable
       
    21 {
       
    22 private:
       
    23   const mystring filename;
       
    24   vpwtable();			// Unimplemented on purpose
       
    25 public:
       
    26   vpwtable(const vdomain*);
       
    27   vpwtable(const vpwtable&);
       
    28   ~vpwtable();
       
    29 
       
    30   vpwtable_reader* start_read() const;
       
    31 
       
    32   vpwentry* getbyname(const mystring& name) const;
       
    33   bool exists(const mystring& name) const;
       
    34   
       
    35   bool put(const vpwentry* vpw, bool onlyadd) const;
       
    36 
       
    37   bool del(const mystring& name) const;
       
    38   inline bool set(const vpwentry* vpw) const
       
    39     {
       
    40       return put(vpw, false);
       
    41     }
       
    42   inline bool add(const vpwentry* vpw) const
       
    43     {
       
    44       return put(vpw, true);
       
    45     }
       
    46 };
       
    47 
       
    48 #endif