]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/cacheset.h
Also support regular expressions and glob() patterns in "Pin: version".
[apt.git] / apt-pkg / cacheset.h
index 0f3a87a3d8b3d03dc619242c05ef653766d922f0..668d8039e0254a134a01135112ab0e74201650af 100644 (file)
@@ -11,6 +11,8 @@
 // Include Files                                                       /*{{{*/
 #include <iostream>
 #include <fstream>
+#include <list>
+#include <map>
 #include <set>
 #include <string>
 
@@ -59,7 +61,7 @@ public:                                                                       /*{{{*/
                };
        };
        // 103. set::iterator is required to be modifiable, but this allows modification of keys
-       typedef typename APT::PackageSet::const_iterator iterator;
+       typedef APT::PackageSet::const_iterator iterator;
 
        using std::set<pkgCache::PkgIterator>::insert;
        inline void insert(pkgCache::PkgIterator const &P) { if (P.end() == false) std::set<pkgCache::PkgIterator>::insert(P); };
@@ -101,6 +103,27 @@ public:                                                                    /*{{{*/
                std::ostream out (std::ofstream("/dev/null").rdbuf());
                return APT::PackageSet::FromCommandLine(Cache, cmdline, out);
        }
+
+       struct Modifier {
+               enum Position { NONE, PREFIX, POSTFIX };
+               unsigned short ID;
+               const char * const Alias;
+               Position Pos;
+               Modifier (unsigned short const &id, const char * const alias, Position const &pos) : ID(id), Alias(alias), Pos(pos) {};
+       };
+
+       static std::map<unsigned short, PackageSet> GroupedFromCommandLine(
+               pkgCacheFile &Cache, const char **cmdline,
+               std::list<PackageSet::Modifier> const &mods,
+               unsigned short const &fallback, std::ostream &out);
+       static std::map<unsigned short, PackageSet> GroupedFromCommandLine(
+               pkgCacheFile &Cache, const char **cmdline,
+               std::list<PackageSet::Modifier> const &mods,
+               unsigned short const &fallback) {
+               std::ostream out (std::ofstream("/dev/null").rdbuf());
+               return APT::PackageSet::GroupedFromCommandLine(Cache, cmdline,
+                               mods, fallback, out);
+       }
                                                                        /*}}}*/
 };                                                                     /*}}}*/
 class VersionSet : public std::set<pkgCache::VerIterator> {            /*{{{*/
@@ -146,7 +169,7 @@ public:                                                                     /*{{{*/
                inline pkgCache::VerFileIterator NewestFile() const { return (**this).NewestFile(); };
        };
        // 103. set::iterator is required to be modifiable, but this allows modification of keys
-       typedef typename APT::VersionSet::const_iterator iterator;
+       typedef APT::VersionSet::const_iterator iterator;
 
        using std::set<pkgCache::VerIterator>::insert;
        inline void insert(pkgCache::VerIterator const &V) { if (V.end() == false) std::set<pkgCache::VerIterator>::insert(V); };