Represents an exclusive lock on the message store. More...
#include <gpopstore.h>
Public Types | |
typedef StoreLockEntry::Size | Size |
typedef StoreLockEntry | Entry |
typedef std::list< Entry > | List |
typedef void(* | Fn) (std::ostream &, const std::string &) |
Public Member Functions | |
StoreLock (Store &store) | |
Constructor. More... | |
void | lock (const std::string &user) |
Initialisation. More... | |
bool | locked () const |
Returns true if locked. More... | |
~StoreLock () | |
Destructor. More... | |
Size | messageCount () const |
Returns the store's message count. More... | |
Size | totalByteCount () const |
Returns the store's total byte count. More... | |
Size | byteCount (int id) const |
Returns a message size. More... | |
std::string | uidl (int id) const |
Returns a message's unique id. More... | |
bool | valid (int id) const |
Validates a message number. More... | |
List | list (int id=-1) const |
Lists messages in the store. More... | |
std::auto_ptr< std::istream > | get (int id) const |
Retrieves the message content. More... | |
void | remove (int) |
Marks the message for removal. More... | |
void | rollback () |
Rolls back remove()als but retains the lock. More... | |
void | commit () |
Commits remove()als. More... | |
Represents an exclusive lock on the message store.
Definition at line 99 of file gpopstore.h.
typedef StoreLockEntry GPop::StoreLock::Entry |
Definition at line 105 of file gpopstore.h.
typedef void(* GPop::StoreLock::Fn) (std::ostream &, const std::string &) |
Definition at line 107 of file gpopstore.h.
typedef std::list<Entry> GPop::StoreLock::List |
Definition at line 106 of file gpopstore.h.
Definition at line 102 of file gpopstore.h.
|
explicit |
Constructor.
Keeps the reference.
Postcondition: !locked()
Definition at line 178 of file gpopstore.cpp.
GPop::StoreLock::~StoreLock | ( | ) |
Destructor.
Definition at line 229 of file gpopstore.cpp.
GPop::StoreLock::Size GPop::StoreLock::byteCount | ( | int | id | ) | const |
void GPop::StoreLock::commit | ( | ) |
Commits remove()als.
Postcondition: !locked()
Definition at line 333 of file gpopstore.cpp.
References G_ASSERT.
std::auto_ptr< std::istream > GPop::StoreLock::get | ( | int | id | ) | const |
Retrieves the message content.
Definition at line 300 of file gpopstore.cpp.
GPop::StoreLock::List GPop::StoreLock::list | ( | int | id = -1 | ) | const |
void GPop::StoreLock::lock | ( | const std::string & | user | ) |
Initialisation.
Precondition: !user.empty() && !locked() Postcondition: locked()
Definition at line 183 of file gpopstore.cpp.
References G::Test::enabled(), G::DirectoryList::fileName(), G_ASSERT, G::DirectoryList::more(), G::DirectoryList::readType(), and G::Path::str().
bool GPop::StoreLock::locked | ( | ) | const |
Returns true if locked.
Definition at line 224 of file gpopstore.cpp.
GPop::StoreLock::Size GPop::StoreLock::messageCount | ( | ) | const |
Returns the store's message count.
Definition at line 233 of file gpopstore.cpp.
References G_ASSERT.
void GPop::StoreLock::remove | ( | int | id | ) |
void GPop::StoreLock::rollback | ( | ) |
GPop::StoreLock::Size GPop::StoreLock::totalByteCount | ( | ) | const |
Returns the store's total byte count.
Definition at line 239 of file gpopstore.cpp.
References G_ASSERT.
std::string GPop::StoreLock::uidl | ( | int | id | ) | const |
bool GPop::StoreLock::valid | ( | int | id | ) | const |