database.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. class pkgFLCache;
  21. class OpProgress;
  22. class pkgDataBase
  23. {
  24. protected:
  25. pkgCacheGenerator *Cache;
  26. pkgFLCache *FList;
  27. std::string MetaDir;
  28. virtual bool InitMetaTmp(std::string &Dir) = 0;
  29. public:
  30. // Some manipulators for the cache and generator
  31. inline pkgCache &GetCache() {return Cache->GetCache();};
  32. inline pkgFLCache &GetFLCache() {return *FList;};
  33. inline pkgCacheGenerator &GetGenerator() {return *Cache;};
  34. bool GetMetaTmp(std::string &Dir);
  35. virtual bool ReadyFileList(OpProgress &Progress) = 0;
  36. virtual bool ReadyPkgCache(OpProgress &Progress) = 0;
  37. virtual bool LoadChanges() = 0;
  38. pkgDataBase() : Cache(0), FList(0) {};
  39. virtual ~pkgDataBase();
  40. };
  41. #endif