libapt-pkg-dev  v0.9.7.5ubuntu5.4
Debian+Ubuntu APT Package Management
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
APT::Configuration Class Reference

Provide access methods to various configuration settings. More...

#include <aptconfiguration.h>

Classes

struct  Compressor
 Representation of supported compressors. More...
 

Static Public Member Functions

static bool const checkArchitecture (std::string const &Arch)
 Are we interested in the given Architecture? More...
 
static bool const checkLanguage (std::string Lang, bool const All=false)
 Are we interested in the given Language? More...
 
static std::vector
< std::string > const 
getArchitectures (bool const &Cached=true)
 Returns a vector of Architectures we support. More...
 
static std::vector
< std::string > const 
getCompressionTypes (bool const &Cached=true)
 Returns a vector of usable Compression Types. More...
 
static std::vector
< std::string > const 
getCompressorExtensions ()
 Return a vector of extensions supported for data.tar's. More...
 
static std::vector< Compressor >
const 
getCompressors (bool const Cached=true)
 Return a vector of Compressors supported for data.tar's. More...
 
static std::vector
< std::string > const 
getLanguages (bool const &All=false, bool const &Cached=true, char const **const Locale=0)
 Returns a vector of Language Codes. More...
 

Static Private Member Functions

static void setDefaultConfigurationForCompressors ()
 

Detailed Description

Provide access methods to various configuration settings.

This class and their methods providing a layer around the usual access methods with _config to ensure that settings are correct and to be able to set defaults without the need to recheck it in every method again.

Member Function Documentation

static bool const APT::Configuration::checkArchitecture ( std::string const &  Arch)
static

Are we interested in the given Architecture?

Parameters
Archwe want to check
Returns
true if we are interested, false otherwise
static bool const APT::Configuration::checkLanguage ( std::string  Lang,
bool const  All = false 
)
static

Are we interested in the given Language?

Parameters
Langis the language we want to check
Alldefines if we check against all codes or only against used codes
Returns
true if we are interested, false otherwise
static std::vector<std::string> const APT::Configuration::getArchitectures ( bool const &  Cached = true)
static

Returns a vector of Architectures we support.

Parameters
Cachedsaves the result so we need to calculated it only once this parameter should ony be used for testing purposes.
Returns
a vector of Architectures in prefered order
static std::vector<std::string> const APT::Configuration::getCompressionTypes ( bool const &  Cached = true)
static

Returns a vector of usable Compression Types.

Files can be compressed in various ways to decrease the size of the download. Therefore the Acquiremethods support a few compression types and some archives provide also a few different types. This option group exists to give the user the choice to prefer one type over the other (some compression types are very resource intensive - great if you have a limited download, bad if you have a really lowpowered hardware.)

This method ensures that the defaults are set and checks at runtime if the type can be used. E.g. the current default is to prefer bzip2 over lzma and gz - if the bzip2 binary is not available it has not much sense in downloading the bz2 file, therefore we will not return bz2 as a usable compression type. The availability is checked with the settings in the Dir::Bin group.

Parameters
Cachedsaves the result so we need to calculated it only once this parameter should ony be used for testing purposes.
Returns
a vector of the compression types in the prefered usage order
static std::vector<std::string> const APT::Configuration::getCompressorExtensions ( )
static

Return a vector of extensions supported for data.tar's.

static std::vector<Compressor> const APT::Configuration::getCompressors ( bool const  Cached = true)
static

Return a vector of Compressors supported for data.tar's.

Parameters
Cachedsaves the result so we need to calculated it only once this parameter should ony be used for testing purposes.
Returns
a vector of Compressors
static std::vector<std::string> const APT::Configuration::getLanguages ( bool const &  All = false,
bool const &  Cached = true,
char const **const  Locale = 0 
)
static

Returns a vector of Language Codes.

Languages can be defined with their two or five chars long code. This methods handles the various ways to set the prefered codes, honors the environment and ensures that the codes are not listed twice.

The special word "environment" will be replaced with the long and the short code of the local settings and it will be insured that this will not add duplicates. So in an german local the setting "environment, de_DE, en, de" will result in "de_DE, de, en".

Another special word is "none" which separates the prefered from all codes in this setting. So setting and method can be used to get codes the user want to see or to get all language codes APT (should) have Translations available.

Parameters
Allreturn all codes or only codes for languages we want to use
Cachedsaves the result so we need to calculated it only once this parameter should ony be used for testing purposes.
Localedon't get the locale from the system but use this one instead this parameter should ony be used for testing purposes.
Returns
a vector of (all) Language Codes in the prefered usage order
static void APT::Configuration::setDefaultConfigurationForCompressors ( )
staticprivate

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