edsp.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 WriteProgress(unsigned short const percent, const char* const message, FILE* output);
  47. bool static WriteError(std::string const &message, FILE* output);
  48. bool static ExecuteSolver(const char* const solver, int *solver_in, int *solver_out);
  49. bool static ResolveExternal(const char* const solver, pkgDepCache &Cache,
  50. bool const upgrade, bool const distUpgrade,
  51. bool const autoRemove);
  52. };
  53. /*}}}*/
  54. #endif