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