- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | List of all members
GPop::StoreLock Class Reference

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...

## Detailed Description

Represents an exclusive lock on the message store.

See also
  RFC-1939

Definition at line 99 of file gpopstore.h.

## Member Typedef Documentation

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.

typedef StoreLockEntry::Size GPop::StoreLock::Size

Definition at line 102 of file gpopstore.h.

## Constructor & Destructor Documentation

GPop::StoreLock::StoreLock | ( | Store & | store | ) |
| 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.

## Member Function Documentation

GPop::StoreLock::Size GPop::StoreLock::byteCount | ( | int | id | ) | const

Returns a message size.

Definition at line 281 of file gpopstore.cpp.

References G_ASSERT.

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.

References G_ASSERT, and G_DEBUG.

GPop::StoreLock::List GPop::StoreLock::list | ( | int | id = `-1` | ) | const

Lists messages in the store.

Definition at line 287 of file gpopstore.cpp.

References G_ASSERT.

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 | ) |

Marks the message for removal.

Definition at line 319 of file gpopstore.cpp.

References G_ASSERT.

void GPop::StoreLock::rollback | ( |  | ) |

Rolls back remove()als but retains the lock.

Precondition: locked() Postcondition: locked() [sic]

Definition at line 437 of file gpopstore.cpp.

References G_ASSERT.

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

Returns a message's unique id.

Definition at line 377 of file gpopstore.cpp.

References G_ASSERT.

bool GPop::StoreLock::valid | ( | int | id | ) | const

Validates a message number.

Definition at line 248 of file gpopstore.cpp.

References G_ASSERT.

The documentation for this class was generated from the following files:

- gpopstore.h
- gpopstore.cpp