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

A class to represent the content of a RiscPkg control file. More...

#include <control.h>

Inheritance diagram for pkg::control:
pkg::binary_control

Classes

class  key_type
 The key type. More...
 
class  parse_error
 An exception class for reporting parse errors. More...
 

Public Types

typedef string mapped_type
 The mapped type. More...
 
typedef std::pair< const key_type, mapped_typevalue_type
 The value type. More...
 
typedef std::map< key_type, mapped_type >::iterator iterator
 The iterator type. More...
 
typedef std::map< key_type, mapped_type >::const_iterator const_iterator
 The constant iterator type. More...
 

Public Member Functions

 control ()
 Construct control file. More...
 
virtual ~control ()
 Destroy control file. More...
 
const_iterator begin () const
 Get constant iterator for beginning of control file. More...
 
const_iterator end () const
 Get constant iterator for end of control file. More...
 
const_iterator find (key_type key) const
 Find constant iterator for key. More...
 
iterator begin ()
 Get iterator for beginning of control file. More...
 
iterator end ()
 Get iterator for end of control file. More...
 
iterator find (key_type key)
 Find iterator for key. More...
 
mapped_typeoperator[] (key_type key)
 Get value corresponding to given key. More...
 
void clear ()
 Clear control file. More...
 
unsigned int size ()
 Get number of fields. More...
 
string pkgname () const
 Get package name. More...
 
string version () const
 Get package version. More...
 
string standards_version () const
 Get standard-version. More...
 
string description () const
 Get description. More...
 
string short_description () const
 Get short description. More...
 
string depends () const
 Get dependencies. More...
 
string recommends () const
 Get recommendations. More...
 
string suggests () const
 Get suggestions. More...
 
string conflicts () const
 Get conflicts. More...
 
string url () const
 Get download URL. More...
 
string components () const
 Get components. More...
 
string environment () const
 Get environment. More...
 
string osdepends () const
 Get OS dependencies. More...
 

Protected Member Functions

virtual int priority (const string &value) const
 Get priority. More...
 

Detailed Description

A class to represent the content of a RiscPkg control file.

Behaviour is that of a map<string,string>, except that:

Member Typedef Documentation

◆ mapped_type

typedef string pkg::control::mapped_type

The mapped type.

◆ value_type

typedef std::pair<const key_type,mapped_type> pkg::control::value_type

The value type.

◆ iterator

The iterator type.

◆ const_iterator

The constant iterator type.

Constructor & Destructor Documentation

◆ control()

pkg::control::control ( )

Construct control file.

◆ ~control()

pkg::control::~control ( )
virtual

Destroy control file.

Member Function Documentation

◆ begin() [1/2]

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

Get constant iterator for beginning of control file.

Returns
the beginning of the control file

Referenced by pkg::operator<<(), and pkg::unpack::poll().

◆ end() [1/2]

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

◆ find() [1/2]

control::const_iterator pkg::control::find ( key_type  key) const

Find constant iterator for key.

Parameters
keythe key to be found
Returns
the field matching the key if there is one, otherwise end().

References priority().

Referenced by components(), conflicts(), depends(), description(), end(), environment(), pkg::binary_control::install_priority(), pkg::operator>>(), osdepends(), pkgname(), pkg::commit::poll(), recommends(), standards_version(), suggests(), url(), pkg::pkgbase::verify_cached_file(), and version().

◆ begin() [2/2]

iterator pkg::control::begin ( )
inline

Get iterator for beginning of control file.

Returns
the beginning of the control file

◆ end() [2/2]

iterator pkg::control::end ( )
inline

◆ find() [2/2]

control::iterator pkg::control::find ( key_type  key)

Find iterator for key.

Parameters
keythe key to be found
Returns
the field matching the key if there is one, otherwise end().

References priority().

◆ operator[]()

control::mapped_type & pkg::control::operator[] ( key_type  key)

Get value corresponding to given key.

If the key does not exist within the control file then it is created. The value is returned as a reference and is writable. The key may be supplied as a string (as opposed to a key_type) and will be automatically converted.

Parameters
keythe key
Returns
a reference to the value

References priority().

Referenced by end().

◆ clear()

void pkg::control::clear ( )

Clear control file.

All keys and values are deleted.

Referenced by end().

◆ size()

unsigned int pkg::control::size ( )

Get number of fields.

Returns
the number of fields

Referenced by end().

◆ pkgname()

string pkg::control::pkgname ( ) const

Get package name.

Returns
the package name if there is one, otherwise the empty string.

References end(), and find().

Referenced by end(), pkg::binary_control_table::insert(), pkg::pkgbase::remove_auto(), pkg::binary_control_table::update(), and pkg::pkgbase::verify_cached_file().

◆ version()

string pkg::control::version ( ) const

Get package version.

Returns
the package version if there is one, otherwise the empty string.

References end(), and find().

Referenced by end(), pkg::pkgbase::fix_dependencies(), pkg::binary_control_table::insert(), pkg::env_packages_table::operator[](), pkg::unpack::poll(), pkg::pkgbase::remove_auto(), and pkg::pkgbase::verify_cached_file().

◆ standards_version()

string pkg::control::standards_version ( ) const

Get standard-version.

Returns
the standards-version if there is one, otherwise the empty string.

References end(), and find().

Referenced by end().

◆ description()

string pkg::control::description ( ) const

Get description.

Returns
the description if there is one, otherwise the empty string.

References end(), and find().

Referenced by end(), pkg::unpack::poll(), and short_description().

◆ short_description()

string pkg::control::short_description ( ) const

Get short description.

Returns
the short description if there is one, otherwise the empty string.

References description().

Referenced by end().

◆ depends()

string pkg::control::depends ( ) const

Get dependencies.

Returns
a comma-separated list of dependencies if there are any, otherwise the empty string

References end(), and find().

Referenced by end(), and pkg::pkgbase::remove_auto().

◆ recommends()

string pkg::control::recommends ( ) const

Get recommendations.

Returns
a comma-separated list of recommendations if there are any, otherwise the empty string

References end(), and find().

Referenced by end().

◆ suggests()

string pkg::control::suggests ( ) const

Get suggestions.

Returns
a comma-separated list of suggestions if there are any, otherwise the empty string

References end(), and find().

Referenced by end().

◆ conflicts()

string pkg::control::conflicts ( ) const

Get conflicts.

Returns
a comma-separated list of conflicts if there are any, otherwise the empty string

References end(), and find().

Referenced by end().

◆ url()

string pkg::control::url ( ) const

Get download URL.

Returns
a URL from which the package may be downloaded if there is one, otherwise the empty string

References end(), and find().

Referenced by end().

◆ components()

string pkg::control::components ( ) const

Get components.

Returns
a comma separated list of components to configure with any associated options, if there are any otherwise the empty string

References end(), and find().

Referenced by end(), and pkg::trigger::trigger().

◆ environment()

string pkg::control::environment ( ) const

Get environment.

Returns
a comma separated list of the environmental features required for this package.

References end(), and find().

Referenced by end(), and pkg::binary_control::package_env().

◆ osdepends()

string pkg::control::osdepends ( ) const

Get OS dependencies.

Returns
a comma separated list of the modules that need to be present in the OS for this package

References end(), and find().

Referenced by end(), and pkg::binary_control::package_env().

◆ priority()

int pkg::control::priority ( const string &  value) const
protectedvirtual

Get priority.

This function may be overridden to modify the sort order. By default, all keys have a priority of 0. The key with the most negative priority is output first.

The returned priority must be consistent for any given key (otherwise data is likely to be lost).

Parameters
valuethe string to be used as a key (converted to lower case)
Returns
the priority

Reimplemented in pkg::binary_control.

Referenced by find(), and operator[]().


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

Reference Manual LibPkg Version 0.9.0 (4 Sep 2020)