lib/vpwtable/vpwtable.h
author "Tomas Zeman <tzeman@volny.cz>"
Wed, 16 Jan 2008 22:39:43 +0100
changeset 0 6f7a81934006
child 2 b3afb9f1e801
permissions -rw-r--r--
Imported vmailmgr-0.96.9

#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