LibPkg
Classes | Public Types | Public Member Functions | List of all members
pkg::component_update Class Reference

A class for managing the updating of package components. More...

#include <component_update.h>

Classes

class  commit_error
 An exception class for reporting failure to commit table. More...
 

Public Types

typedef std::vector< component >::const_iterator const_iterator
 

Public Member Functions

 component_update (const string &pathname=string())
 Construct component update. More...
 
virtual ~component_update ()
 Destroy component update. More...
 
const componentoperator[] (const std::string &name) const
 Get component details for a component name The updates cannot be modified using this operator. More...
 
const_iterator begin () const
 Get const iterator for start of the updates. More...
 
const_iterator end () const
 Get const iterator for end of the updates. More...
 
const_iterator find (const std::string &name) const
 Find const iterator for a component name. More...
 
void insert (const component &value)
 Add a component. More...
 
void insert (const component_update &table)
 Insert contents of another table into this one, overwriting any existing items. More...
 
void clear ()
 Clear status of all components. More...
 
void commit ()
 Commit changes. More...
 
void rollback ()
 Roll back changes. More...
 
void done ()
 The updates have been completed, so remove the file. More...
 

Detailed Description

A class for managing the updating of package components.

Member Typedef Documentation

◆ const_iterator

Constructor & Destructor Documentation

◆ component_update()

pkg::component_update::component_update ( const string &  pathname = string())

Construct component update.

Parameters
pathnamethe pathname of the underlying component update file

References rollback().

◆ ~component_update()

pkg::component_update::~component_update ( )
virtual

Destroy component update.

Member Function Documentation

◆ operator[]()

const component & pkg::component_update::operator[] ( const std::string &  name) const

Get component details for a component name The updates cannot be modified using this operator.

Parameters
keythe package name
Returns
the status of the package

◆ begin()

const_iterator pkg::component_update::begin ( ) const
inline

Get const iterator for start of the updates.

Returns
the const iterator

Referenced by insert().

◆ end()

const_iterator pkg::component_update::end ( ) const
inline

Get const iterator for end of the updates.

Returns
the const iterator

References clear(), commit(), done(), find(), insert(), and rollback().

Referenced by insert().

◆ find()

component_update::const_iterator pkg::component_update::find ( const std::string &  name) const

Find const iterator for a component name.

Parameters
namethe component name
Returns
the const iterator, or end() if not found

Referenced by end().

◆ insert() [1/2]

void pkg::component_update::insert ( const component value)

Add a component.

The underlying updates file will not be modified until the change is committed.

Parameters
valuethe new component

References pkg::component::name().

Referenced by done(), end(), and insert().

◆ insert() [2/2]

void pkg::component_update::insert ( const component_update table)

Insert contents of another table into this one, overwriting any existing items.

References begin(), end(), and insert().

◆ clear()

void pkg::component_update::clear ( )

Clear status of all components.

Referenced by end().

◆ commit()

void pkg::component_update::commit ( )

Commit changes.

Any changes since the last call to commit() or rollback() are committed to disc.

References dst_pathname, pkg::force_delete(), pkg::force_move(), and pkg::object_type().

Referenced by end().

◆ rollback()

void pkg::component_update::rollback ( )

Roll back changes.

Any changes since the last call to commit() or rollback() are discarded.

References done().

Referenced by component_update(), and end().

◆ done()

void pkg::component_update::done ( )

The updates have been completed, so remove the file.

References pkg::force_delete(), insert(), and pkg::object_type().

Referenced by end(), and rollback().


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

Reference Manual LibPkg Version 0.9.0 (4 Sep 2020)