X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/0fffbc8ce4cb6357f59db63db5571f46a668a66b..acddd9188c21c2e13aff5cea3a82f2d01aff788b:/apt-pkg/contrib/configuration.h diff --git a/apt-pkg/contrib/configuration.h b/apt-pkg/contrib/configuration.h index f6f2a3c1d..97a01e4cf 100644 --- a/apt-pkg/contrib/configuration.h +++ b/apt-pkg/contrib/configuration.h @@ -34,6 +34,12 @@ #include #include +#include + +#ifndef APT_8_CLEANER_HEADERS +using std::string; +#endif + class Configuration { public: @@ -55,7 +61,7 @@ class Configuration Item *Root; bool ToFree; - + Item *Lookup(Item *Head,const char *S,unsigned long const &Len,bool const &Create); Item *Lookup(const char *Name,const bool &Create); inline const Item *Lookup(const char *Name) const @@ -70,8 +76,17 @@ class Configuration std::string Find(std::string const &Name, std::string const &Default) const {return Find(Name.c_str(),Default.c_str());}; std::string FindFile(const char *Name,const char *Default = 0) const; std::string FindDir(const char *Name,const char *Default = 0) const; - std::vector FindVector(const char *Name) const; - std::vector FindVector(std::string const &Name) const { return FindVector(Name.c_str()); }; + /** return a list of child options + * + * Options like Acquire::Languages are handled as lists which + * can be overridden and have a default. For the later two a comma + * separated list of values is supported. + * + * \param Name of the parent node + * \param Default list of values separated by commas */ + std::vector FindVector(const char *Name, std::string const &Default = "", bool const Keys = false) const; + std::vector FindVector(std::string const &Name, std::string const &Default = "", bool const Keys = false) const { return FindVector(Name.c_str(), Default, Keys); }; + int FindI(const char *Name,int const &Default = 0) const; int FindI(std::string const &Name,int const &Default = 0) const {return FindI(Name.c_str(),Default);}; bool FindB(const char *Name,bool const &Default = false) const; @@ -88,8 +103,11 @@ class Configuration bool Exists(const char *Name) const; bool ExistsAny(const char *Name) const; + void MoveSubTree(char const * const OldRoot, char const * const NewRoot); + // clear a whole tree void Clear(const std::string &Name); + void Clear(); // remove a certain value from a list (e.g. the list of "APT::Keep-Fds") void Clear(std::string const &List, std::string const &Value); @@ -99,6 +117,8 @@ class Configuration inline void Dump() { Dump(std::clog); }; void Dump(std::ostream& str); + void Dump(std::ostream& str, char const * const root, + char const * const format, bool const emptyValue); Configuration(const Item *Root); Configuration(); @@ -108,7 +128,7 @@ class Configuration class MatchAgainstConfig { std::vector patterns; - void clearPatterns(); + APT_HIDDEN void clearPatterns(); public: MatchAgainstConfig(char const * Config);