apt  1.5
edsp.h
Go to the documentation of this file.
00001 // -*- mode: cpp; mode: fold -*-
00008                                                                         /*}}}*/
00009 #ifndef PKGLIB_EDSP_H
00010 #define PKGLIB_EDSP_H
00011 
00012 #include <apt-pkg/pkgcache.h>
00013 #include <apt-pkg/cacheset.h>
00014 
00015 #include <list>
00016 #include <string>
00017 
00018 #ifndef APT_8_CLEANER_HEADERS
00019 #include <apt-pkg/depcache.h>
00020 #include <apt-pkg/progress.h>
00021 #endif
00022 
00023 class pkgDepCache;
00024 class OpProgress;
00025 
00026 class EDSP                                                              /*{{{*/
00027 {
00028         // we could use pkgCache::DepType and ::Priority, but these would be localized strings…
00029         static const char * const PrioMap[];
00030         static const char * const DepMap[];
00031 
00032         bool static ReadLine(int const input, std::string &line);
00033         bool static StringToBool(char const *answer, bool const defValue);
00034 
00035         void static WriteScenarioVersion(pkgDepCache &Cache, FILE* output,
00036                                          pkgCache::PkgIterator const &Pkg,
00037                                          pkgCache::VerIterator const &Ver);
00038         void static WriteScenarioDependency(pkgDepCache &Cache, FILE* output,
00039                                             pkgCache::PkgIterator const &Pkg,
00040                                             pkgCache::VerIterator const &Ver);
00041         void static WriteScenarioLimitedDependency(pkgDepCache &Cache, FILE* output,
00042                                                    pkgCache::PkgIterator const &Pkg,
00043                                                    pkgCache::VerIterator const &Ver,
00044                                                    APT::PackageSet const &pkgset);
00045 public:
00062         bool static WriteRequest(pkgDepCache &Cache, FILE* output,
00063                                  bool const upgrade = false,
00064                                  bool const distUpgrade = false,
00065                                  bool const autoRemove = false,
00066                                 OpProgress *Progress = NULL);
00067 
00085         bool static WriteScenario(pkgDepCache &Cache, FILE* output, OpProgress *Progress = NULL);
00086 
00102         bool static WriteLimitedScenario(pkgDepCache &Cache, FILE* output,
00103                                          APT::PackageSet const &pkgset,
00104                                          OpProgress *Progress = NULL);
00105 
00119         bool static ReadResponse(int const input, pkgDepCache &Cache, OpProgress *Progress = NULL);
00120 
00137         bool static ReadRequest(int const input, std::list<std::string> &install,
00138                         std::list<std::string> &remove, bool &upgrade,
00139                         bool &distUpgrade, bool &autoRemove);
00140 
00153         bool static ApplyRequest(std::list<std::string> const &install,
00154                                  std::list<std::string> const &remove,
00155                                  pkgDepCache &Cache);
00156 
00169         bool static WriteSolution(pkgDepCache &Cache, FILE* output);
00170 
00177         bool static WriteProgress(unsigned short const percent, const char* const message, FILE* output);
00178 
00194         bool static WriteError(char const * const uuid, std::string const &message, FILE* output);
00195 
00196 
00209         bool static ExecuteSolver(const char* const solver, int *solver_in, int *solver_out);
00210 
00225         bool static ResolveExternal(const char* const solver, pkgDepCache &Cache,
00226                                     bool const upgrade, bool const distUpgrade,
00227                                     bool const autoRemove, OpProgress *Progress = NULL);
00228 };
00229                                                                         /*}}}*/
00230 #endif