diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2010-06-15 20:29:50 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2010-06-15 20:29:50 +0200 |
commit | 55c59998a046e8d60b5bf51772bd7db5cd43ca7c (patch) | |
tree | 1ef1403dd7ebcf16cca7c509daa72c8a37c5a492 /apt-pkg/cacheset.h | |
parent | 98ac10fad90f622b67a8cda3cffc041885c2e054 (diff) | |
download | apt-55c59998a046e8d60b5bf51772bd7db5cd43ca7c.tar.gz |
Add a GroupedFromCommandLine for the VersionSet similar to the
one for PackageSet and refactor the existing VersionSet methods
to simplify that.
Diffstat (limited to 'apt-pkg/cacheset.h')
-rw-r--r-- | apt-pkg/cacheset.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h index 668d8039e..2bc268380 100644 --- a/apt-pkg/cacheset.h +++ b/apt-pkg/cacheset.h @@ -209,6 +209,41 @@ public: /*{{{*/ static APT::VersionSet FromCommandLine(pkgCacheFile &Cache, const char **cmdline) { return APT::VersionSet::FromCommandLine(Cache, cmdline, CANDINST); } + + static APT::VersionSet FromString(pkgCacheFile &Cache, std::string pkg, + APT::VersionSet::Version const &fallback, std::ostream &out); + static APT::VersionSet FromString(pkgCacheFile &Cache, std::string pkg, + APT::VersionSet::Version const &fallback) { + std::ostream out (std::ofstream("/dev/null").rdbuf()); + return APT::VersionSet::FromString(Cache, pkg, fallback, out); + } + static APT::VersionSet FromString(pkgCacheFile &Cache, std::string pkg) { + return APT::VersionSet::FromString(Cache, pkg, CANDINST); + } + + struct Modifier { + enum Position { NONE, PREFIX, POSTFIX }; + unsigned short ID; + const char * const Alias; + Position Pos; + VersionSet::Version SelectVersion; + Modifier (unsigned short const &id, const char * const alias, Position const &pos, + VersionSet::Version const &select) : ID(id), Alias(alias), Pos(pos), + SelectVersion(select) {}; + }; + + static std::map<unsigned short, VersionSet> GroupedFromCommandLine( + pkgCacheFile &Cache, const char **cmdline, + std::list<VersionSet::Modifier> const &mods, + unsigned short const &fallback, std::ostream &out); + static std::map<unsigned short, VersionSet> GroupedFromCommandLine( + pkgCacheFile &Cache, const char **cmdline, + std::list<VersionSet::Modifier> const &mods, + unsigned short const &fallback) { + std::ostream out (std::ofstream("/dev/null").rdbuf()); + return APT::VersionSet::GroupedFromCommandLine(Cache, cmdline, + mods, fallback, out); + } /*}}}*/ protected: /*{{{*/ |