diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2009-09-04 19:32:45 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2009-09-04 19:32:45 +0200 |
commit | 50c409c42a971c6e8a25cb32a87992474247834b (patch) | |
tree | 2136f8c4528c9cab87c76cd5f3491a11fe9bd3b4 /apt-pkg/contrib/configuration.cc | |
parent | b43af876ed0901eabfb7fe93276eb9272cacf22d (diff) |
add a helper to easily get a vector of strings from the configuration
Diffstat (limited to 'apt-pkg/contrib/configuration.cc')
-rw-r--r-- | apt-pkg/contrib/configuration.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 48a5f0bff..b83ece3e4 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -223,6 +223,25 @@ string Configuration::FindDir(const char *Name,const char *Default) const return Res; } /*}}}*/ +// Configuration::FindVector - Find a vector of values /*{{{*/ +// --------------------------------------------------------------------- +/* Returns a vector of config values under the given item */ +vector<string> Configuration::FindVector(const char *Name) const +{ + vector<string> Vec; + const Item *Top = Lookup(Name); + if (Top == NULL) + return Vec; + + Item *I = Top->Child; + while(I != NULL) + { + Vec.push_back(I->Value); + I = I->Next; + } + return Vec; +} + /*}}}*/ // Configuration::FindI - Find an integer value /*{{{*/ // --------------------------------------------------------------------- /* */ |