database.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: database.h,v 1.2 2001/02/20 07:03:16 jgg Exp $
  4. /* ######################################################################
  5. Data Base Abstraction
  6. This class provides a simple interface to an abstract notion of a
  7. database directory for storing state information about the system.
  8. The 'Meta' information for a package is the control information and
  9. setup scripts stored inside the archive. GetMetaTmp returns the name of
  10. a directory that is used to store named files containing the control
  11. information.
  12. The File Listing is the database of installed files. It is loaded
  13. into the memory/persistent cache structure by the ReadFileList method.
  14. ##################################################################### */
  15. /*}}}*/
  16. #ifndef PKGLIB_DATABASE_H
  17. #define PKGLIB_DATABASE_H
  18. #include <apt-pkg/pkgcachegen.h>
  19. #include <string>
  20. #ifndef APT_8_CLEANER_HEADERS
  21. #include <apt-pkg/filelist.h>
  22. #endif
  23. class pkgFLCache;
  24. class OpProgress;
  25. class pkgDataBase
  26. {
  27. protected:
  28. pkgCacheGenerator *Cache;
  29. pkgFLCache *FList;
  30. std::string MetaDir;
  31. virtual bool InitMetaTmp(std::string &Dir) = 0;
  32. public:
  33. // Some manipulators for the cache and generator
  34. inline pkgCache &GetCache() {return Cache->GetCache();};
  35. inline pkgFLCache &GetFLCache() {return *FList;};
  36. inline pkgCacheGenerator &GetGenerator() {return *Cache;};
  37. bool GetMetaTmp(std::string &Dir);
  38. virtual bool ReadyFileList(OpProgress &Progress) = 0;
  39. virtual bool ReadyPkgCache(OpProgress &Progress) = 0;
  40. virtual bool LoadChanges() = 0;
  41. pkgDataBase() : Cache(0), FList(0) {};
  42. virtual ~pkgDataBase();
  43. };
  44. #endif