apt 3.0.3
commandline package manager
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CacheSetHelper Class Reference

Classes

struct  PkgModifier
 
class  Private
 

Public Types

enum  PkgSelector {
  UNKNOWN , REGEX , TASK , FNMATCH ,
  PACKAGENAME , STRING , PATTERN
}
 
enum  VerSelector {
  RELEASE , VERSIONNUMBER , ALL , CANDANDINST ,
  CANDIDATE , INSTALLED , CANDINST , INSTCAND ,
  NEWEST
}
 specifies which version(s) we want to refer to More...
 

Public Member Functions

 CacheSetHelper (bool const ShowError=true, GlobalError::MsgType ErrorType=GlobalError::ERROR)
 
virtual bool PackageFrom (enum PkgSelector const select, PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string const &pattern)
 
virtual bool PackageFromCommandLine (PackageContainerInterface *const pci, pkgCacheFile &Cache, const char **cmdline)
 
virtual bool PackageFromModifierCommandLine (unsigned short &modID, PackageContainerInterface *const pci, pkgCacheFile &Cache, const char *cmdline, std::list< PkgModifier > const &mods)
 
virtual void showPackageSelection (pkgCache::PkgIterator const &pkg, PkgSelector const select, std::string const &pattern)
 be notified about the package being selected via pattern
 
virtual void canNotFindPackage (enum PkgSelector const select, PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string const &pattern)
 be notified if a package can't be found via pattern
 
virtual void showVersionSelection (pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const &Ver, enum VerSelector const select, std::string const &pattern)
 be notified about the version being selected via pattern
 
virtual void canNotFindVersion (enum VerSelector const select, VersionContainerInterface *const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg)
 be notified if a version can't be found for a package
 
virtual pkgCache::VerIterator canNotGetVersion (enum VerSelector const select, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg)
 
virtual pkgCache::PkgIterator canNotFindPkgName (pkgCacheFile &Cache, std::string const &str)
 
bool showErrors () const
 
bool showErrors (bool const newValue)
 
GlobalError::MsgType errorType () const
 
GlobalError::MsgType errorType (GlobalError::MsgType const &newValue)
 
std::string getLastVersionMatcher () const
 
void setLastVersionMatcher (std::string const &matcher)
 

Protected Member Functions

pkgCache::VerIterator canNotGetInstCandVer (pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg)
 
pkgCache::VerIterator canNotGetCandInstVer (pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg)
 
pkgCache::VerIterator canNotGetVerFromRelease (pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg, std::string const &release)
 
pkgCache::VerIterator canNotGetVerFromVersionNumber (pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg, std::string const &verstr)
 
bool PackageFromTask (PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string pattern)
 
bool PackageFromRegEx (PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string pattern)
 
bool PackageFromFnmatch (PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string pattern)
 
bool PackageFromPackageName (PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string pattern)
 
bool PackageFromString (PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string const &pattern)
 
bool PackageFromPattern (PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string const &pattern)
 

Protected Attributes

bool ShowError
 
GlobalError::MsgType ErrorType
 

Detailed Description

Simple base class with a lot of virtual methods which can be overridden to alter the behavior or the output of the CacheSets.

This helper is passed around by the static methods in the CacheSets and used every time they hit an error condition or something could be printed out.

Member Enumeration Documentation

◆ VerSelector

specifies which version(s) we want to refer to

Enumerator
RELEASE 

by release string

VERSIONNUMBER 

by version number string

ALL 

All versions

CANDANDINST 

Candidate and installed version

CANDIDATE 

Candidate version

INSTALLED 

Installed version

CANDINST 

Candidate or if non installed version

INSTCAND 

Installed or if non candidate version

NEWEST 

Newest version

Member Function Documentation

◆ canNotFindPackage()

void canNotFindPackage ( enum PkgSelector const  select,
PackageContainerInterface *const  pci,
pkgCacheFile Cache,
std::string const &  pattern 
)
virtual

be notified if a package can't be found via pattern

Can be used to show a message as well as to try something else to make it match

Parameters
selectis the method tried for selection
pciis the container the package should be inserted in
Cacheis the package universe available
patternis the string not matching anything

References CacheSetHelper::canNotFindPackage().

Referenced by CacheSetHelper::canNotFindPackage(), and CacheSetHelper::PackageFromString().

◆ canNotFindVersion()

void canNotFindVersion ( enum VerSelector const  select,
VersionContainerInterface *const  vci,
pkgCacheFile Cache,
pkgCache::PkgIterator const &  Pkg 
)
virtual

be notified if a version can't be found for a package

Main use is probably to show a message to the user what happened

Parameters
selectis the method tried for selection
vciis the container the version should be inserted in
Cacheis the package universe available
Pkgis the package we wanted a version from

References CacheSetHelper::ALL, CacheSetHelper::CANDANDINST, CacheSetHelper::CANDIDATE, CacheSetHelper::CANDINST, CacheSetHelper::INSTALLED, CacheSetHelper::INSTCAND, CacheSetHelper::NEWEST, CacheSetHelper::RELEASE, and CacheSetHelper::VERSIONNUMBER.

◆ PackageFromString()

bool PackageFromString ( PackageContainerInterface *const  pci,
pkgCacheFile Cache,
std::string const &  pattern 
)
protected
Todo:
hm, hm, regexp/fnmatch incompatible?

References CacheSetHelper::canNotFindPackage().

◆ showPackageSelection()

void showPackageSelection ( pkgCache::PkgIterator const &  pkg,
PkgSelector const  select,
std::string const &  pattern 
)
virtual

be notified about the package being selected via pattern

Main use is probably to show a message to the user what happened

Parameters
pkgis the package which was selected
selectis the selection method which choose the package
patternis the string used by the selection method to pick the package

◆ showVersionSelection()

void showVersionSelection ( pkgCache::PkgIterator const &  Pkg,
pkgCache::VerIterator const &  Ver,
enum VerSelector const  select,
std::string const &  pattern 
)
virtual

be notified about the version being selected via pattern

Main use is probably to show a message to the user what happened Note that at the moment this method is only called for RELEASE and VERSION selections, not for the others.

Parameters
Pkgis the package which was selected for
Veris the version selected
selectis the selection method which choose the version
patternis the string used by the selection method to pick the version

References CacheSetHelper::ALL, CacheSetHelper::CANDANDINST, CacheSetHelper::CANDIDATE, CacheSetHelper::CANDINST, CacheSetHelper::INSTALLED, CacheSetHelper::INSTCAND, CacheSetHelper::NEWEST, CacheSetHelper::RELEASE, and CacheSetHelper::VERSIONNUMBER.


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