database.h 1.6 KB

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