edsp.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. /* ######################################################################
  4. Set of methods to help writing and reading everything needed for EDSP
  5. ##################################################################### */
  6. /*}}}*/
  7. #ifndef PKGLIB_EDSP_H
  8. #define PKGLIB_EDSP_H
  9. #include <apt-pkg/depcache.h>
  10. #include <apt-pkg/cacheset.h>
  11. #include <string>
  12. class EDSP /*{{{*/
  13. {
  14. // we could use pkgCache::DepType and ::Priority, but these would be localized strings…
  15. static const char * const PrioMap[];
  16. static const char * const DepMap[];
  17. bool static ReadLine(int const input, std::string &line);
  18. bool static StringToBool(char const *answer, bool const defValue);
  19. void static WriteScenarioVersion(pkgDepCache &Cache, FILE* output,
  20. pkgCache::PkgIterator const &Pkg,
  21. pkgCache::VerIterator const &Ver);
  22. void static WriteScenarioDependency(pkgDepCache &Cache, FILE* output,
  23. pkgCache::PkgIterator const &Pkg,
  24. pkgCache::VerIterator const &Ver);
  25. void static WriteScenarioLimitedDependency(pkgDepCache &Cache, FILE* output,
  26. pkgCache::PkgIterator const &Pkg,
  27. pkgCache::VerIterator const &Ver,
  28. APT::PackageSet const &pkgset);
  29. public:
  30. bool static WriteRequest(pkgDepCache &Cache, FILE* output,
  31. bool const upgrade = false,
  32. bool const distUpgrade = false,
  33. bool const autoRemove = false);
  34. bool static WriteScenario(pkgDepCache &Cache, FILE* output);
  35. bool static WriteLimitedScenario(pkgDepCache &Cache, FILE* output,
  36. APT::PackageSet const &pkgset);
  37. bool static ReadResponse(int const input, pkgDepCache &Cache);
  38. // ReadScenario is provided by the listparser infrastructure
  39. bool static ReadRequest(int const input, std::list<std::string> &install,
  40. std::list<std::string> &remove, bool &upgrade,
  41. bool &distUpgrade, bool &autoRemove);
  42. bool static ApplyRequest(std::list<std::string> const &install,
  43. std::list<std::string> const &remove,
  44. pkgDepCache &Cache);
  45. bool static WriteSolution(pkgDepCache &Cache, FILE* output);
  46. bool static WriteError(std::string const &message, FILE* output);
  47. };
  48. /*}}}*/
  49. #endif