// Include Files /*{{{*/
#include <iostream>
#include <fstream>
+#include <list>
+#include <map>
#include <set>
#include <string>
};
};
// 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
\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);
}
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> { /*{{{*/
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 {
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);
+
/*}}}*/
}; /*}}}*/
}