apt 3.0.3
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 >:
[legend]
Collaboration diagram for PackageContainer< Container >:
[legend]

Public Types

typedef Container_const_iterator< PackageContainerInterface, Container, PackageContainerconst_iterator
 smell like a pkgCache::PkgIterator
 
typedef Container_iterator< PackageContainerInterface, Container, PackageContaineriterator
 
typedef Container_const_reverse_iterator< PackageContainerInterface, Container, PackageContainerconst_reverse_iterator
 
typedef Container_reverse_iterator< PackageContainerInterface, Container, PackageContainerreverse_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)
 
PackageContainerInterfaceoperator= (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, PackageContainerGroupedFromCommandLine (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, PackageContainerGroupedFromCommandLine (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 ( )
inlineoverridevirtual

◆ empty()

template<class Container >
bool empty ( ) const
inlineoverridevirtual

◆ FromCommandLine()

template<class Container >
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
Cachethe packages are in
cmdlineCommand line the package names should be extracted from
helperresponsible for error and message handling

◆ FromRegEx()

template<class Container >
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
Cachethe packages are in
patternregular expression for package names
helperresponsible for error and message handling

◆ FromString()

template<class Container >
static PackageContainer FromString ( pkgCacheFile Cache,
std::string const &  pattern,
CacheSetHelper helper 
)
inlinestatic

returns all packages specified by a string

Parameters
Cachethe packages are in
patternString the package name(s) should be extracted from
helperresponsible for error and message handling

◆ FromTask()

template<class Container >
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
Cachethe packages are in
patternname of the task
helperresponsible for error and message handling

◆ GroupedFromCommandLine()

template<class Container >
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
Cachethe packages are in
cmdlineCommand line the package names should be extracted from
modslist of modifiers the method should accept
fallbackthe default modifier group for a package
helperresponsible for error and message handling

◆ insert() [1/4]

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

◆ insert() [2/4]

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

◆ insert() [3/4]

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

◆ insert() [4/4]

template<class Container >
bool insert ( pkgCache::PkgIterator const &  P)
inlineoverridevirtual

◆ size()

template<class Container >
size_t size ( ) const
inlineoverridevirtual

◆ 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: