C++ binding for the SQLite3 library
Public Member Functions | Protected Member Functions | List of all members
sqlitepp::Openable Class Reference

An element that has the two states open and closed. More...

#include <sqlitepp/sqlitepp.h>

Inheritance diagram for sqlitepp::Openable:
Inheritance graph

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

Detailed Description

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.

Constructor & Destructor Documentation

◆ Openable()

sqlitepp::Openable::Openable ( const bool  open,
const std::string &  name 

Creates a new Openable.

opentrue if the objet should be open per default; false if it shoukd be closed per defaut
namethe name of the implementing class used in error messages

Member Function Documentation

◆ isOpen()

bool sqlitepp::Openable::isOpen ( ) const

Checks whether this object is open.

true if this object is open; false if it is closed

◆ requireOpen()

void sqlitepp::Openable::requireOpen ( ) const

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_errorif this object is not open

◆ setOpen()

void sqlitepp::Openable::setOpen ( const bool  open)

Changes the state of this object.

openthe new state of this object (true if it should be opened; false if it should be closed)

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