sqlitepp
C++ binding for the SQLite3 library
|
An element that has the two states open and closed. More...
#include <sqlitepp/sqlitepp.h>
Public Member Functions | |
bool | isOpen () const |
Checks whether this object is open. More... | |
Protected Member Functions | |
Openable (const bool open, const std::string &name) | |
Creates a new Openable. More... | |
void | requireOpen () const |
Requires this object to be open and throws an exception if it is not. More... | |
void | setOpen (const bool open) |
Changes the state of this object. More... | |
An element that has the two states open and closed.
Subclasses of this class may define methods that require the object to be in a specific state. Refer to the implementing class’s documentation for more information about the methods that require a specific state.
The default state depends on the implementation. You can check the state of an object using the isOpen() method.
Implementing classes may use setOpen() to change the state and requireOpen() to throw a std::logic_error if the object is currently not open.
|
protected |
Creates a new Openable.
open | true if the objet should be open per default; false if it shoukd be closed per defaut |
name | the name of the implementing class used in error messages |
bool sqlitepp::Openable::isOpen | ( | ) | const |
Checks whether this object is open.
true
if this object is open; false
if it is closed
|
protected |
Requires this object to be open and throws an exception if it is not.
This method should be used at the beginning of other subclass methods that require this object to be open. The error message of the exception will contain the class name passed to the constructor.
std::logic_error | if this object is not open |
|
protected |
Changes the state of this object.
open | the new state of this object (true if it should be opened; false if it should be closed) |