]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/cacheset.h
be sure that the RFC1123StrToTime method is run in a LANG=C environment
[apt.git] / apt-pkg / cacheset.h
index 708531b4ab1799311d5409b9793ed7de5eb775e2..668d8039e0254a134a01135112ab0e74201650af 100644 (file)
@@ -11,6 +11,8 @@
 // Include Files                                                       /*{{{*/
 #include <iostream>
 #include <fstream>
+#include <list>
+#include <map>
 #include <set>
 #include <string>
 
@@ -59,7 +61,10 @@ 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); };
 
        /** \brief returns all packages in the cache whose name matchs a given pattern
 
@@ -80,8 +85,8 @@ public:                                                                       /*{{{*/
            \param Cache the packages are in
            \param string String the package name(s) should be extracted from
            \param out stream to print various notices to */
-       static APT::PackageSet FromString(pkgCacheFile &Cache, const char * const string, std::ostream &out);
-       static APT::PackageSet FromString(pkgCacheFile &Cache, const char * const string) {
+       static APT::PackageSet FromString(pkgCacheFile &Cache, std::string const &string, std::ostream &out);
+       static APT::PackageSet FromString(pkgCacheFile &Cache, std::string const &string) {
                std::ostream out (std::ofstream("/dev/null").rdbuf());
                return APT::PackageSet::FromString(Cache, string, out);
        }
@@ -98,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> {            /*{{{*/
@@ -143,7 +169,10 @@ 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); };
 
        /** \brief specifies which version(s) will be returned if non is given */
        enum Version {
@@ -199,6 +228,11 @@ protected:                                                         /*{{{*/
        static pkgCache::VerIterator getInstalledVer(pkgCacheFile &Cache,
                pkgCache::PkgIterator const &Pkg, bool const &AllowError = false);
 
+
+       static bool AddSelectedVersion(pkgCacheFile &Cache, VersionSet &verset,
+               pkgCache::PkgIterator const &P, VersionSet::Version const &fallback,
+               bool const &AllowError = false);
+
                                                                        /*}}}*/
 };                                                                     /*}}}*/
 }