PackageContainer< Container > Class Template Reference
Inheritance diagram for PackageContainer< Container >:
[legend]
Collaboration diagram for PackageContainer< Container >:
[legend]

## Public Types

typedef Container_const_iterator< PackageContainerInterface, Container, PackageContainer > | const_iterator
| smell like a pkgCache::PkgIterator
typedef Container_iterator< PackageContainerInterface, Container, PackageContainer > | iterator
typedef Container_const_reverse_iterator< PackageContainerInterface, Container, PackageContainer > | const_reverse_iterator
typedef Container_reverse_iterator< PackageContainerInterface, Container, PackageContainer > | reverse_iterator
typedef Container::value_type | value_type
typedef Container::pointer | pointer
typedef Container::const_pointer | const_pointer
typedef Container::reference | reference
typedef Container::const_reference | const_reference
typedef Container::difference_type | difference_type
typedef Container::size_type | size_type
typedef Container::allocator_type | allocator_type

## Public Member Functions

bool | insert (pkgCache::PkgIterator const &P) override
template<class Cont>
void | insert (PackageContainer< Cont > const &pkgcont)
void | insert (const_iterator begin, const_iterator end)
bool | empty () const override
void | clear () override
size_t | size () const override
iterator | erase (iterator pos)
iterator | erase (iterator first, iterator last)
const_iterator | begin () const
const_iterator | end () const
const_reverse_iterator | rbegin () const
const_reverse_iterator | rend () const
iterator | begin ()
iterator | end ()
reverse_iterator | rbegin ()
reverse_iterator | rend ()
const_iterator | find (pkgCache::PkgIterator const &P) const
| PackageContainer (CacheSetHelper::PkgSelector const &by)
template<typename Itr>
| PackageContainer (Itr first, Itr last)
void | push_back (const value_type &P)
template<class Compare>
bool | sort (Compare)
| sort all included versions with given comparer
void | insert (PackageContainer< Cont > const &pkgcont)
void | insert (PackageContainer< Cont > const &pkgcont)
void | insert (PackageContainer< Cont > const &pkgcont)
bool | insert (pkgCache::PkgIterator const &P)
bool | insert (pkgCache::PkgIterator const &P)
bool | insert (pkgCache::PkgIterator const &P)
void | insert (const_iterator begin, const_iterator end)
void | insert (const_iterator begin, const_iterator end)
void | insert (const_iterator begin, const_iterator end)
PackageContainer< std::set< pkgCache::PkgIterator > >::iterator | erase (iterator i)
PackageContainer< std::set< pkgCache::PkgIterator > >::iterator | erase (iterator first, iterator last)
bool | sort (Compare Comp)
bool | sort (Compare Comp)
bool | sort (Compare Comp)
Public Member Functions inherited from PackageContainerInterface
void | setConstructor (CacheSetHelper::PkgSelector const by)
CacheSetHelper::PkgSelector | getConstructor () const
| PackageContainerInterface (CacheSetHelper::PkgSelector const by)
| PackageContainerInterface (PackageContainerInterface const &by)
PackageContainerInterface & | operator= (PackageContainerInterface const &other)

## Static Public Member Functions

static PackageContainer | FromTask (pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper)
| returns all packages in the cache who belong to the given task
static PackageContainer | FromTask (pkgCacheFile &Cache, std::string const &pattern)
static PackageContainer | FromRegEx (pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper)
| returns all packages in the cache whose name matches a given pattern
static PackageContainer | FromRegEx (pkgCacheFile &Cache, std::string const &pattern)
static PackageContainer | FromFnmatch (pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper)
static PackageContainer | FromFnMatch (pkgCacheFile &Cache, std::string const &pattern)
static PackageContainer | FromString (pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper)
| returns all packages specified by a string
static PackageContainer | FromString (pkgCacheFile &Cache, std::string const &pattern)
static PackageContainer | FromCommandLine (pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper)
| returns all packages specified on the commandline
static PackageContainer | FromCommandLine (pkgCacheFile &Cache, const char **cmdline)
static std::map< unsigned short, PackageContainer > | GroupedFromCommandLine (pkgCacheFile &Cache, const char **cmdline, std::list< CacheSetHelper::PkgModifier > const &mods, unsigned short const &fallback, CacheSetHelper &helper)
| group packages by a action modifiers
static std::map< unsigned short, PackageContainer > | GroupedFromCommandLine (pkgCacheFile &Cache, const char **cmdline, std::list< CacheSetHelper::PkgModifier > const &mods, unsigned short const &fallback)

## Detailed Description

template<class Container>
class APT::PackageContainer< Container >

Simple wrapper around a container class like std::set to provide a similar interface to a set of packages as to the complete set of all packages in the pkgCache.

## Member Function Documentation

## clear()

template<class Container>

void clear | ( |  | ) |

inline override virtual

Implements PackageContainerInterface.

## empty()

template<class Container>

bool empty | ( |  | ) | const

inline nodiscard override virtual

Implements PackageContainerInterface.

## FromCommandLine()

template<class Container>

PackageContainer FromCommandLine | ( | pkgCacheFile & | Cache,
|  | const char ** | cmdline,
|  | CacheSetHelper & | helper )

inline static

returns all packages specified on the commandline

Get all package names from the commandline and executes regex's if needed. No special package command is supported, just plain names.

Parameters

  Cache | the packages are in
  cmdline | Command line the package names should be extracted from
  helper | responsible for error and message handling

## FromRegEx()

template<class Container>

PackageContainer FromRegEx | ( | pkgCacheFile & | Cache,
|  | std::string const & | pattern,
|  | CacheSetHelper & | helper )

inline static

returns all packages in the cache whose name matches a given pattern

A simple helper responsible for executing a regular expression on all package names in the cache. Optional it prints a notice about the packages chosen cause of the given package.

Parameters

  Cache | the packages are in
  pattern | regular expression for package names
  helper | responsible for error and message handling

## FromString()

template<class Container>

PackageContainer FromString | ( | pkgCacheFile & | Cache,
|  | std::string const & | pattern,
|  | CacheSetHelper & | helper )

inline static

returns all packages specified by a string

Parameters

  Cache | the packages are in
  pattern | String the package name(s) should be extracted from
  helper | responsible for error and message handling

## FromTask()

template<class Container>

PackageContainer FromTask | ( | pkgCacheFile & | Cache,
|  | std::string const & | pattern,
|  | CacheSetHelper & | helper )

inline static

returns all packages in the cache who belong to the given task

A simple helper responsible for search for all members of a task in the cache. Optional it prints a notice about the packages chosen cause of the given task.

Parameters

  Cache | the packages are in
  pattern | name of the task
  helper | responsible for error and message handling

## GroupedFromCommandLine()

template<class Container>

std::map< unsigned short, PackageContainer > GroupedFromCommandLine | ( | pkgCacheFile & | Cache,
|  | const char ** | cmdline,
|  | std::list< CacheSetHelper::PkgModifier > const & | mods,
|  | unsigned short const & | fallback,
|  | CacheSetHelper & | helper )

inline static

group packages by a action modifiers

At some point it is needed to get from the same commandline different package sets grouped by a modifier. Take apt-get install apt awesome- as an example.

Parameters

  Cache | the packages are in
  cmdline | Command line the package names should be extracted from
  mods | list of modifiers the method should accept
  fallback | the default modifier group for a package
  helper | responsible for error and message handling

## insert() [1/4]

bool insert | ( | pkgCache::PkgIterator const & | P | ) |

inline virtual

Implements PackageContainerInterface.

## insert() [2/4]

bool insert | ( | pkgCache::PkgIterator const & | P | ) |

inline virtual

Implements PackageContainerInterface.

## insert() [3/4]

bool insert | ( | pkgCache::PkgIterator const & | P | ) |

inline virtual

Implements PackageContainerInterface.

## insert() [4/4]

template<class Container>

bool insert | ( | pkgCache::PkgIterator const & | P | ) |

inline override virtual

Implements PackageContainerInterface.

## size()

template<class Container>

size_t size | ( |  | ) | const

inline nodiscard override virtual

Implements PackageContainerInterface.

## sort()

template<class Container>
template<class Compare>

bool sort | ( | Compare |  | ) |

inline

sort all included versions with given comparer

Some containers are sorted by default, some are not and can't be, but a few like std::vector can be sorted if need be, so this can be specialized in later on. The default is that this will fail though. Specifically, already sorted containers like std::set will return false as well as there is no easy way to check that the given comparer would sort in the same way the set is currently sorted

Returns
  true if the set was sorted, false if not.

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

- apt-pkg/cacheset.h