version.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: version.h,v 1.8 2001/05/27 05:55:27 jgg Exp $
  4. /* ######################################################################
  5. Version - Versioning system..
  6. The versioning system represents how versions are compared, represented
  7. and how dependencies are evaluated. As a general rule versioning
  8. systems are not compatible unless specifically allowed by the
  9. TestCompatibility query.
  10. The versions are stored in a global list of versions, but that is just
  11. so that they can be queried when someone does 'apt-get -v'.
  12. pkgSystem provides the proper means to access the VS for the active
  13. system.
  14. ##################################################################### */
  15. /*}}}*/
  16. #ifndef PKGLIB_VERSION_H
  17. #define PKGLIB_VERSION_H
  18. #include <apt-pkg/strutl.h>
  19. #include <string>
  20. class pkgVersioningSystem
  21. {
  22. public:
  23. // Global list of VS's
  24. static pkgVersioningSystem **GlobalList;
  25. static unsigned long GlobalListLen;
  26. static pkgVersioningSystem *GetVS(const char *Label);
  27. const char *Label;
  28. // Compare versions..
  29. virtual int DoCmpVersion(const char *A,const char *Aend,
  30. const char *B,const char *Bend) = 0;
  31. virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer) = 0;
  32. virtual int DoCmpReleaseVer(const char *A,const char *Aend,
  33. const char *B,const char *Bend) = 0;
  34. virtual std::string UpstreamVersion(const char *A) = 0;
  35. // See if the given VS is compatible with this one..
  36. virtual bool TestCompatibility(pkgVersioningSystem const &Against)
  37. {return this == &Against;};
  38. // Shortcuts
  39. APT_MKSTRCMP(CmpVersion,DoCmpVersion);
  40. APT_MKSTRCMP(CmpReleaseVer,DoCmpReleaseVer);
  41. pkgVersioningSystem();
  42. virtual ~pkgVersioningSystem() {};
  43. };
  44. #ifdef APT_COMPATIBILITY
  45. #include <apt-pkg/debversion.h>
  46. #endif
  47. #endif