diff options
author | Michael Vogt <egon@debian-devbox> | 2012-10-17 10:29:52 +0200 |
---|---|---|
committer | Michael Vogt <egon@debian-devbox> | 2012-10-17 10:29:52 +0200 |
commit | d4273c55e34cdf5a355b4edd92df61a83cfab318 (patch) | |
tree | 171d8a91864f0b746c58ded2f1c2bdaf0bb82d29 | |
parent | 20a2b201389092a17763b703039b2e4528234e30 (diff) | |
parent | 62b66f2593293aea5b42185fd2a2eb9d6e4d0cf2 (diff) |
* lp:~mvo/apt/config-clear:
- support Configuration.Clear() for a clear of the entire
configuration
-rw-r--r-- | apt-pkg/contrib/configuration.cc | 12 | ||||
-rw-r--r-- | apt-pkg/contrib/configuration.h | 1 | ||||
-rw-r--r-- | debian/changelog | 3 | ||||
-rw-r--r-- | test/libapt/configuration_test.cc | 4 |
4 files changed, 20 insertions, 0 deletions
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 4de17e3e1..d5334ae72 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -422,6 +422,18 @@ void Configuration::Clear(string const &Name, string const &Value) } /*}}}*/ +// Configuration::Clear - Clear everything /*{{{*/ +// --------------------------------------------------------------------- +void Configuration::Clear() +{ + const Configuration::Item *Top = Tree(0); + while( Top != 0 ) + { + Clear(Top->FullTag()); + Top = Top->Next; + } +} + /*}}}*/ // Configuration::Clear - Clear an entire tree /*{{{*/ // --------------------------------------------------------------------- /* */ diff --git a/apt-pkg/contrib/configuration.h b/apt-pkg/contrib/configuration.h index ea94c2fe6..8e09ea0a6 100644 --- a/apt-pkg/contrib/configuration.h +++ b/apt-pkg/contrib/configuration.h @@ -94,6 +94,7 @@ class Configuration // 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); diff --git a/debian/changelog b/debian/changelog index e93ed51ae..904e920bf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,9 @@ apt (0.9.8~exp1) UNRELEASED; urgency=low * stop exporting the accidently exported parsenetrc() symbol * lp:~mvo/apt/add-glob-function: - add Glob() to fileutl.{cc,h} + * lp:~mvo/apt/config-clear: + - support Configuration.Clear() for a clear of the entire + configuration -- David Kalnischkies <kalnischkies@gmail.com> Mon, 09 Jul 2012 17:36:40 +0200 diff --git a/test/libapt/configuration_test.cc b/test/libapt/configuration_test.cc index 87d5699ef..2c974ee0a 100644 --- a/test/libapt/configuration_test.cc +++ b/test/libapt/configuration_test.cc @@ -98,6 +98,10 @@ int main(int argc,const char *argv[]) { equals(Cnf.FindDir("Dir::State"), "/rootdir/dev/null"); equals(Cnf.FindDir("Dir::State::lists"), "/rootdir/dev/null"); + Cnf.Set("Moo::Bar", "1"); + Cnf.Clear(); + equals(Cnf.Find("Moo::Bar"), ""); + //FIXME: Test for configuration file parsing; // currently only integration/ tests test them implicitly |