version.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. #ifdef __GNUG__
  19. #pragma interface "apt-pkg/version.h"
  20. #endif
  21. #include <apt-pkg/strutl.h>
  22. #include <string>
  23. using std::string;
  24. class pkgVersioningSystem
  25. {
  26. public:
  27. // Global list of VS's
  28. static pkgVersioningSystem **GlobalList;
  29. static unsigned long GlobalListLen;
  30. static pkgVersioningSystem *GetVS(const char *Label);
  31. const char *Label;
  32. // Compare versions..
  33. virtual int DoCmpVersion(const char *A,const char *Aend,
  34. const char *B,const char *Bend) = 0;
  35. virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer) = 0;
  36. virtual int DoCmpReleaseVer(const char *A,const char *Aend,
  37. const char *B,const char *Bend) = 0;
  38. virtual string UpstreamVersion(const char *A) = 0;
  39. // See if the given VS is compatible with this one..
  40. virtual bool TestCompatibility(pkgVersioningSystem const &Against)
  41. {return this == &Against;};
  42. // Shortcuts
  43. APT_MKSTRCMP(CmpVersion,DoCmpVersion);
  44. APT_MKSTRCMP(CmpReleaseVer,DoCmpReleaseVer);
  45. pkgVersioningSystem();
  46. virtual ~pkgVersioningSystem() {};
  47. };
  48. #ifdef APT_COMPATIBILITY
  49. #include <apt-pkg/debversion.h>
  50. #endif
  51. #endif