apt: PackageContainer< Container > Class Template Reference

apt 2.3.15 commandline package manager

Public Types | Public Member Functions | Static Public Member Functions | List of all members
PackageContainer< Container > Class Template Reference
Inheritance diagram for PackageContainer< Container >:

## 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) APT_OVERRIDE
template<class Cont >
void | insert (PackageContainer< Cont > const &pkgcont)
void | insert (const_iterator begin, const_iterator end)
bool | empty () const APT_OVERRIDE
void | clear () APT_OVERRIDE
size_t | size () const APT_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 More...
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
virtual bool | insert (pkgCache::PkgIterator const &P)=0
virtual bool | empty () const =0
virtual void | clear ()=0
virtual size_t | size () const =0
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 More...
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 More...
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 More...
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 More...
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 More...
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()

void clear | ( |  | ) |
| inlinevirtual

Implements PackageContainerInterface.

## ◆ empty()

bool empty | ( |  | ) | const
| inlinevirtual

Implements PackageContainerInterface.

## ◆ FromCommandLine()

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

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()

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

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()

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

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()

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

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()

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

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 | ) |
| inlinevirtual

Implements PackageContainerInterface.

## ◆ insert() [2/4]

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

Implements PackageContainerInterface.

## ◆ insert() [3/4]

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

Implements PackageContainerInterface.

## ◆ insert() [4/4]

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

Implements PackageContainerInterface.

## ◆ size()

size_t size | ( |  | ) | const
| inlinevirtual

Implements PackageContainerInterface.

## ◆ sort()

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