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

A class to represent a package dependency. More...

#include <dependency.h>

Classes

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

Public Types

enum  relation_type {
  relation_al, relation_eq, relation_lt, relation_ge,
  relation_le, relation_gt
}
 An enumerated type to specify a relational operator for comparing versions. More...
 

Public Member Functions

 dependency ()
 Construct dependency with default value. More...
 
 dependency (const string &pkgname, relation_type relation, const pkg::version &version)
 Construct dependency from components. More...
 
 dependency (string::const_iterator first, string::const_iterator last)
 Construct dependency from sequence. More...
 
 dependency (const string &depstr)
 Construct dependency from string. More...
 
 ~dependency ()
 Destroy dependency. More...
 
 operator string () const
 Convert dependency to string. More...
 
const string & pkgname () const
 Get package name. More...
 
relation_type relation () const
 Get relational operator. More...
 
const pkg::versionversion () const
 Get version. More...
 
bool matches (const string &pkgname, const pkg::version &pkgvrsn) const
 Test whether dependency is satisfied by a given package/version. More...
 

Detailed Description

A class to represent a package dependency.

Syntax and semantics are as specified in version 3.5.6 of the Debian Policy Manual, except that:

Member Enumeration Documentation

◆ relation_type

An enumerated type to specify a relational operator for comparing versions.

Enumerator
relation_al 

A relational operator that is always true.

relation_eq 

A relational operator that is true when two versions are equal.

relation_lt 

A relational operator that is true when the first version is earlier than the second.

relation_ge 

A relational operator that is true when the first version is later or equal to the second.

relation_le 

A relational operator that is true when the first version is earlier or equal to the second.

relation_gt 

A relational operator that is true when the first version is later than the second.

Constructor & Destructor Documentation

◆ dependency() [1/4]

pkg::dependency::dependency ( )

Construct dependency with default value.

By default the dependency has an empty package name and is satisfied by any version.

◆ dependency() [2/4]

pkg::dependency::dependency ( const string &  pkgname,
relation_type  relation,
const pkg::version version 
)

Construct dependency from components.

Parameters
pkgnamethe package name
relationthe relational operator to be satisfied
versionthe version to which the relational operator refers

◆ dependency() [3/4]

pkg::dependency::dependency ( string::const_iterator  first,
string::const_iterator  last 
)

Construct dependency from sequence.

Parameters
firstthe beginning of the sequence
lastthe end of the sequence

◆ dependency() [4/4]

pkg::dependency::dependency ( const string &  depstr)

Construct dependency from string.

Parameters
depstrthe dependency string

◆ ~dependency()

pkg::dependency::~dependency ( )

Destroy dependency.

Member Function Documentation

◆ operator string()

pkg::dependency::operator string ( ) const

Convert dependency to string.

Returns
the dependency as a string

References relation_al, relation_eq, relation_ge, relation_gt, relation_le, and relation_lt.

◆ pkgname()

const string& pkg::dependency::pkgname ( ) const
inline

Get package name.

Returns
the package name

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

◆ relation()

relation_type pkg::dependency::relation ( ) const
inline

Get relational operator.

Returns
the relational operator to be satisified

◆ version()

const pkg::version& pkg::dependency::version ( ) const
inline

Get version.

Returns
the version to which the relational operator refers

References matches(), and pkgname().

◆ matches()

bool pkg::dependency::matches ( const string &  pkgname,
const pkg::version pkgvrsn 
) const

Test whether dependency is satisfied by a given package/version.

Parameters
pkgnamethe name of the package to be tested
pkgvrsnthe version of the package to be tested
Returns
true if the dependency is satisfied, otherwise false

References relation_al, relation_eq, relation_ge, relation_gt, relation_le, and relation_lt.

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


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

Reference Manual LibPkg Version 0.9.0 (4 Sep 2020)