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

A class to represent the current or required status of a package. More...

#include <status.h>

Classes

class  parse_error
 An exception class for reporting parse errors. More...
 

Public Types

enum  state_type {
  state_not_present, state_removed, state_half_unpacked, state_unpacked,
  state_half_configured, state_installed
}
 
enum  flag_type { flag_auto, flag_hold }
 
enum  internal_flag_type { flag_must_remove, flag_must_install, flag_must_upgrade }
 

Public Member Functions

 status ()
 Construct status. More...
 
 status (state_type state, const string &version, const string &environment_id)
 Construct status given installation state and version. More...
 
 ~status ()
 Destroy status. More...
 
state_type state () const
 Get installation state. More...
 
bool flag (flag_type flag) const
 Get status flag. More...
 
bool flag (internal_flag_type flag) const
 Get internal flag. More...
 
unsigned int flags () const
 Get status flags. More...
 
string version () const
 Get package version. More...
 
string environment_id () const
 Get environment id. More...
 
void state (state_type state)
 Set installation state. More...
 
void flag (flag_type flag, bool value)
 Set status flag. More...
 
void flag (internal_flag_type flag, bool value)
 Set internal flag. More...
 
void version (const string &version)
 Set package version. More...
 
void environment_id (const string &environment_id)
 Set package environment id. More...
 

Detailed Description

A class to represent the current or required status of a package.

The status consists of three components:

States are ordered, and it is meaningful to use the inequality operators to compare them. If state A is greater than state B then A is closer to the fully installed state.

Note that not-present is rarely used because this state is usually indicated by the absence of an entry in the status file.

Member Enumeration Documentation

◆ state_type

Enumerator
state_not_present 

A state to indicate that a package has either been purged or was never installed.

state_removed 

A state to indicate that a package has been removed but its configuration files may remain.

state_half_unpacked 

A state to indicate that a package is partially unpacked or partially removed.

This is a transient state unless a failure occurs.

state_unpacked 

A state to indicate that a package has been unpacked but not configured.

state_half_configured 

A state to indicate that a package is partially configured.

This is a transient state unless a failure occurs.

state_installed 

A state to indicate that a package has been successfully unpacked and configured.

◆ flag_type

Enumerator
flag_auto 

A flag to indicate that a package has been installed automatically to meet a dependency (and should therefore be removed automatically if that dependency ceases to exist).

flag_hold 

A flag to indicate that a package has been placed on hold (which prevents any change of state unless explicitly requested by the user).

◆ internal_flag_type

Enumerator
flag_must_remove 

A flag to indicate that this package must be removed.

Specifically, its selection state must be state_removed if all dependencies are to be satisfied.

flag_must_install 

A flag to indicate that this package must be installed.

Specifically, its selection state must be state_installed if all dependencies are to be satisfied.

flag_must_upgrade 

A flag to indicate that this package must be upgraded.

Specifically, its selected version must be the latest available version if all dependencies are to be satisfied.

Constructor & Destructor Documentation

◆ status() [1/2]

pkg::status::status ( )

Construct status.

By default, the package is not-present and all flags are clear.

◆ status() [2/2]

pkg::status::status ( state_type  state,
const string &  version,
const string &  environment_id 
)

Construct status given installation state and version.

By default, all flags are clear.

Parameters
statethe required installation state
versionthe required version
environment_idthe required environment

◆ ~status()

pkg::status::~status ( )

Destroy status.

Member Function Documentation

◆ state() [1/2]

state_type pkg::status::state ( ) const
inline

◆ flag() [1/4]

bool pkg::status::flag ( flag_type  flag) const
inline

Get status flag.

Parameters
flagthe flag to be read
Returns
the value of the flag

Referenced by environment_id(), pkg::pkgbase::fix_dependencies(), flag(), pkg::unpack::poll(), and pkg::pkgbase::remove_auto().

◆ flag() [2/4]

bool pkg::status::flag ( internal_flag_type  flag) const
inline

Get internal flag.

Parameters
flagthe flag to be read
Returns
the value of the flag

◆ flags()

unsigned int pkg::status::flags ( ) const
inline

Get status flags.

Returns
a bit field containing the status flags

Referenced by pkg::operator!=(), pkg::operator==(), and pkg::operator>>().

◆ version() [1/2]

string pkg::status::version ( ) const
inline

◆ environment_id() [1/2]

string pkg::status::environment_id ( ) const
inline

◆ state() [2/2]

void pkg::status::state ( state_type  state)

Set installation state.

Parameters
statethe required installation state

References state().

◆ flag() [3/4]

void pkg::status::flag ( flag_type  flag,
bool  value 
)

Set status flag.

Parameters
flagthe flag to be altered
valuethe required value

References flag().

◆ flag() [4/4]

void pkg::status::flag ( internal_flag_type  flag,
bool  value 
)

Set internal flag.

Parameters
flagthe flag to be altered
valuethe required value

References flag().

◆ version() [2/2]

void pkg::status::version ( const string &  version)

Set package version.

Parameters
versionthe required package version

References version().

◆ environment_id() [2/2]

void pkg::status::environment_id ( const string &  environment_id)

Set package environment id.

Parameters
environmentid to specified the environment required

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

Reference Manual LibPkg Version 0.9.0 (4 Sep 2020)