apt  2.2.4
About: Apt (Advanced Package Tool) is a management system for software packages (Debian/Ubuntu). Release series 2.2.
  Fossies Dox: apt-2.2.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

PackageContainer< Container > Class Template Reference

#include <cacheset.h>

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 More...
 
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) 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 ()
 
 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
void setConstructor (CacheSetHelper::PkgSelector const by)
 
CacheSetHelper::PkgSelector getConstructor () const
 
 PackageContainerInterface ()
 
 PackageContainerInterface (CacheSetHelper::PkgSelector const by)
 
 PackageContainerInterface (PackageContainerInterface const &by)
 
PackageContainerInterfaceoperator= (PackageContainerInterface const &other)
 
virtual ~PackageContainerInterface ()
 

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, PackageContainerGroupedFromCommandLine (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, PackageContainerGroupedFromCommandLine (pkgCacheFile &Cache, const char **cmdline, std::list< CacheSetHelper::PkgModifier > const &mods, unsigned short const &fallback)
 

Private Attributes

Container _cont
 

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.

Definition at line 335 of file cacheset.h.

Member Typedef Documentation

◆ allocator_type

typedef Container::allocator_type allocator_type

Definition at line 355 of file cacheset.h.

◆ const_iterator

◆ const_pointer

typedef Container::const_pointer const_pointer

Definition at line 350 of file cacheset.h.

◆ const_reference

typedef Container::const_reference const_reference

Definition at line 352 of file cacheset.h.

◆ const_reverse_iterator

◆ difference_type

typedef Container::difference_type difference_type

Definition at line 353 of file cacheset.h.

◆ iterator

Definition at line 345 of file cacheset.h.

◆ pointer

typedef Container::pointer pointer

Definition at line 349 of file cacheset.h.

◆ reference

typedef Container::reference reference

Definition at line 351 of file cacheset.h.

◆ reverse_iterator

◆ size_type

typedef Container::size_type size_type

Definition at line 354 of file cacheset.h.

◆ value_type

typedef Container::value_type value_type

Definition at line 348 of file cacheset.h.

Constructor & Destructor Documentation

◆ PackageContainer() [1/3]

PackageContainer ( )
inline

Definition at line 387 of file cacheset.h.

◆ PackageContainer() [2/3]

PackageContainer ( CacheSetHelper::PkgSelector const &  by)
inlineexplicit

Definition at line 388 of file cacheset.h.

◆ PackageContainer() [3/3]

PackageContainer ( Itr  first,
Itr  last 
)
inline

Definition at line 389 of file cacheset.h.

Member Function Documentation

◆ begin() [1/2]

iterator begin ( )
inline

Definition at line 381 of file cacheset.h.

◆ begin() [2/2]

◆ clear()

void clear ( )
inlinevirtual

◆ empty()

bool empty ( ) const
inlinevirtual

◆ end() [1/2]

iterator end ( )
inline

Definition at line 382 of file cacheset.h.

◆ end() [2/2]

◆ erase() [1/4]

◆ erase() [2/4]

PackageContainer< std::set< pkgCache::PkgIterator > >::iterator erase ( iterator  first,
iterator  last 
)
inline

Definition at line 595 of file cacheset.h.

References PackageContainer< Container >::erase().

◆ erase() [3/4]

◆ erase() [4/4]

◆ find()

const_iterator find ( pkgCache::PkgIterator const &  P) const
inline

Definition at line 385 of file cacheset.h.

Referenced by DoMinimize().

◆ FromCommandLine() [1/2]

static PackageContainer FromCommandLine ( pkgCacheFile Cache,
const char **  cmdline 
)
inlinestatic

Definition at line 483 of file cacheset.h.

◆ FromCommandLine() [2/2]

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

Definition at line 478 of file cacheset.h.

References CacheSetHelper::PackageFromCommandLine().

Referenced by DoAuto(), DoMarkAuto(), DumpPackage(), main(), Policy(), ShowAuto(), and ShowSelection().

◆ FromFnMatch()

static PackageContainer FromFnMatch ( pkgCacheFile Cache,
std::string const &  pattern 
)
inlinestatic

Definition at line 451 of file cacheset.h.

◆ FromFnmatch()

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

Definition at line 446 of file cacheset.h.

References CacheSetHelper::FNMATCH, and CacheSetHelper::PackageFrom().

◆ FromRegEx() [1/2]

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

Definition at line 441 of file cacheset.h.

◆ FromRegEx() [2/2]

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

Definition at line 435 of file cacheset.h.

References CacheSetHelper::PackageFrom(), and CacheSetHelper::REGEX.

◆ FromString() [1/2]

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

Definition at line 466 of file cacheset.h.

◆ FromString() [2/2]

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

Definition at line 461 of file cacheset.h.

References CacheSetHelper::PackageFrom(), and CacheSetHelper::PACKAGENAME.

Referenced by Madison().

◆ FromTask() [1/2]

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

Definition at line 422 of file cacheset.h.

◆ FromTask() [2/2]

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

Definition at line 417 of file cacheset.h.

References CacheSetHelper::PackageFrom(), and CacheSetHelper::TASK.

◆ GroupedFromCommandLine() [1/2]

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

Definition at line 514 of file cacheset.h.

◆ GroupedFromCommandLine() [2/2]

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

Definition at line 499 of file cacheset.h.

References I, and CacheSetHelper::PackageFromModifierCommandLine().

Referenced by Dotty(), and XVcg().

◆ insert() [1/12]

void insert ( const_iterator  begin,
const_iterator  end 
)
inline

Definition at line 359 of file cacheset.h.

◆ insert() [2/12]

void insert ( const_iterator  begin,
const_iterator  end 
)
inline

Definition at line 572 of file cacheset.h.

References PackageContainer< Container >::push_back().

◆ insert() [3/12]

void insert ( const_iterator  begin,
const_iterator  end 
)
inline

Definition at line 582 of file cacheset.h.

References PackageContainer< Container >::push_back().

◆ insert() [4/12]

void insert ( const_iterator  begin,
const_iterator  end 
)
inline

Definition at line 586 of file cacheset.h.

References PackageContainer< Container >::push_back().

◆ insert() [5/12]

void insert ( PackageContainer< Cont > const &  pkgcont)
inline

◆ insert() [6/12]

◆ insert() [7/12]

◆ insert() [8/12]

◆ insert() [9/12]

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

Implements PackageContainerInterface.

Definition at line 546 of file cacheset.h.

References PackageContainer< Container >::push_back().

◆ insert() [10/12]

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

Implements PackageContainerInterface.

Definition at line 560 of file cacheset.h.

References PackageContainer< Container >::push_back().

◆ insert() [11/12]

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

Implements PackageContainerInterface.

Definition at line 566 of file cacheset.h.

References PackageContainer< Container >::push_back().

◆ insert() [12/12]

◆ push_back()

◆ rbegin() [1/2]

reverse_iterator rbegin ( )
inline

Definition at line 383 of file cacheset.h.

◆ rbegin() [2/2]

const_reverse_iterator rbegin ( ) const
inline

Definition at line 373 of file cacheset.h.

◆ rend() [1/2]

reverse_iterator rend ( )
inline

Definition at line 384 of file cacheset.h.

◆ rend() [2/2]

const_reverse_iterator rend ( ) const
inline

Definition at line 374 of file cacheset.h.

◆ size()

size_t size ( ) const
inlinevirtual

Implements PackageContainerInterface.

Definition at line 363 of file cacheset.h.

Referenced by ShowAuto(), and ShowSelection().

◆ sort() [1/4]

bool sort ( Compare  Comp)
inline

Definition at line 600 of file cacheset.h.

◆ sort() [2/4]

bool sort ( Compare  Comp)
inline

Definition at line 604 of file cacheset.h.

References PackageContainer< Container >::sort().

◆ sort() [3/4]

bool sort ( Compare  Comp)
inline

Definition at line 614 of file cacheset.h.

◆ sort() [4/4]

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.

Definition at line 407 of file cacheset.h.

Referenced by PackageContainer< Container >::sort().

Member Data Documentation

◆ _cont

Container _cont
private

Definition at line 341 of file cacheset.h.


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