]> git.saurik.com Git - apt.git/blame - apt-pkg/aptconfiguration.h
debian/control: Set Standards-Version to 3.9.7
[apt.git] / apt-pkg / aptconfiguration.h
CommitLineData
e878aedb
DK
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3/** \class APT::Configuration
4 * \brief Provide access methods to various configuration settings
5 *
6 * This class and their methods providing a layer around the usual access
7 * methods with _config to ensure that settings are correct and to be able
8 * to set defaults without the need to recheck it in every method again.
9 */
10 /*}}}*/
11#ifndef APT_CONFIGURATION_H
12#define APT_CONFIGURATION_H
13// Include Files /*{{{*/
14#include <string>
15#include <vector>
dd688285 16#include <limits>
e878aedb
DK
17 /*}}}*/
18namespace APT {
c8a4ce6c 19namespace Configuration { /*{{{*/
e878aedb
DK
20 /** \brief Returns a vector of usable Compression Types
21 *
22 * Files can be compressed in various ways to decrease the size of the
23 * download. Therefore the Acquiremethods support a few compression types
24 * and some archives provide also a few different types. This option
25 * group exists to give the user the choice to prefer one type over the
26 * other (some compression types are very resource intensive - great if you
27 * have a limited download, bad if you have a really lowpowered hardware.)
28 *
29 * This method ensures that the defaults are set and checks at runtime
30 * if the type can be used. E.g. the current default is to prefer bzip2
31 * over lzma and gz - if the bzip2 binary is not available it has not much
32 * sense in downloading the bz2 file, therefore we will not return bz2 as
33 * a usable compression type. The availability is checked with the settings
34 * in the Dir::Bin group.
35 *
36 * \param Cached saves the result so we need to calculated it only once
37 * this parameter should ony be used for testing purposes.
38 *
1e3f4083 39 * \return a vector of the compression types in the preferred usage order
e878aedb 40 */
c8a4ce6c 41 std::vector<std::string> const getCompressionTypes(bool const &Cached = true);
45df0ad2
DK
42
43 /** \brief Returns a vector of Language Codes
44 *
45 * Languages can be defined with their two or five chars long code.
1e3f4083 46 * This methods handles the various ways to set the preferred codes,
45df0ad2
DK
47 * honors the environment and ensures that the codes are not listed twice.
48 *
49 * The special word "environment" will be replaced with the long and the short
50 * code of the local settings and it will be insured that this will not add
51 * duplicates. So in an german local the setting "environment, de_DE, en, de"
52 * will result in "de_DE, de, en".
53 *
1e3f4083 54 * Another special word is "none" which separates the preferred from all codes
45df0ad2
DK
55 * in this setting. So setting and method can be used to get codes the user want
56 * to see or to get all language codes APT (should) have Translations available.
57 *
58 * \param All return all codes or only codes for languages we want to use
59 * \param Cached saves the result so we need to calculated it only once
60 * this parameter should ony be used for testing purposes.
61 * \param Locale don't get the locale from the system but use this one instead
62 * this parameter should ony be used for testing purposes.
63 *
1e3f4083 64 * \return a vector of (all) Language Codes in the preferred usage order
45df0ad2 65 */
c8a4ce6c 66 std::vector<std::string> const getLanguages(bool const &All = false,
83742b3c 67 bool const &Cached = true, char const ** const Locale = 0);
45df0ad2 68
c45233ea
DK
69 /** \brief Are we interested in the given Language?
70 *
71 * \param Lang is the language we want to check
72 * \param All defines if we check against all codes or only against used codes
73 * \return true if we are interested, false otherwise
74 */
c8a4ce6c 75 bool checkLanguage(std::string Lang, bool const All = false);
c45233ea 76
5dd4c8b8
DK
77 /** \brief Returns a vector of Architectures we support
78 *
79 * \param Cached saves the result so we need to calculated it only once
80 * this parameter should ony be used for testing purposes.
81 *
1e3f4083 82 * \return a vector of Architectures in preferred order
5dd4c8b8 83 */
c8a4ce6c 84 std::vector<std::string> const getArchitectures(bool const &Cached = true);
5dd4c8b8
DK
85
86 /** \brief Are we interested in the given Architecture?
87 *
88 * \param Arch we want to check
89 * \return true if we are interested, false otherwise
90 */
c8a4ce6c 91 bool checkArchitecture(std::string const &Arch);
5dd4c8b8 92
03bef784
DK
93 /** \brief Representation of supported compressors */
94 struct Compressor {
95 std::string Name;
96 std::string Extension;
97 std::string Binary;
98 std::vector<std::string> CompressArgs;
99 std::vector<std::string> UncompressArgs;
100 unsigned short Cost;
101
102 Compressor(char const *name, char const *extension, char const *binary,
103 char const *compressArg, char const *uncompressArg,
104 unsigned short const cost);
dd688285 105 Compressor() : Cost(std::numeric_limits<unsigned short>::max()) {};
03bef784
DK
106 };
107
108 /** \brief Return a vector of Compressors supported for data.tar's
109 *
110 * \param Cached saves the result so we need to calculated it only once
111 * this parameter should ony be used for testing purposes.
112 *
113 * \return a vector of Compressors
114 */
c8a4ce6c 115 std::vector<Compressor> const getCompressors(bool const Cached = true);
b0e1a43f
DK
116
117 /** \brief Return a vector of extensions supported for data.tar's */
c8a4ce6c 118 std::vector<std::string> const getCompressorExtensions();
ce7f128c
DK
119
120 /** \return Return a vector of enabled build profile specifications */
c8a4ce6c 121 std::vector<std::string> const getBuildProfiles();
ce7f128c 122 /** \return Return a comma-separated list of enabled build profile specifications */
c8a4ce6c 123 std::string const getBuildProfilesString();
03bef784 124 /*}}}*/
c3392a9f 125}
e878aedb
DK
126 /*}}}*/
127}
128#endif