versionmatch.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: versionmatch.h,v 1.2 2001/02/20 07:03:17 jgg Exp $
  4. /* ######################################################################
  5. Version Matching
  6. This module takes a matching string and a type and locates the version
  7. record that satisfies the constraint described by the matching string.
  8. Version: 1.2*
  9. Release: o=Debian,v=2.1*,c=main
  10. Release: v=2.1*
  11. Release: *
  12. Origin: ftp.debian.org
  13. Release may be a complex type that can specify matches for any of:
  14. Version (v= with prefix)
  15. Origin (o=)
  16. Archive (a=)
  17. Label (l=)
  18. Component (c=)
  19. If there are no equals signs in the string then it is scanned in short
  20. form - if it starts with a number it is Version otherwise it is an
  21. Archive.
  22. Release may be a '*' to match all releases.
  23. ##################################################################### */
  24. /*}}}*/
  25. #ifndef PKGLIB_VERSIONMATCH_H
  26. #define PKGLIB_VERSIONMATCH_H
  27. #ifdef __GNUG__
  28. #pragma interface "apt-pkg/versionmatch.h"
  29. #endif
  30. #include <string>
  31. #include <apt-pkg/pkgcache.h>
  32. class pkgVersionMatch
  33. {
  34. // Version Matching
  35. string VerStr;
  36. bool VerPrefixMatch;
  37. // Release Matching
  38. string RelVerStr;
  39. bool RelVerPrefixMatch;
  40. string RelOrigin;
  41. string RelArchive;
  42. string RelLabel;
  43. string RelComponent;
  44. // Origin Matching
  45. string OrSite;
  46. public:
  47. enum MatchType {None = 0,Version,Release,Origin} Type;
  48. bool MatchVer(const char *A,string B,bool Prefix);
  49. bool FileMatch(pkgCache::PkgFileIterator File);
  50. pkgCache::VerIterator Find(pkgCache::PkgIterator Pkg);
  51. pkgVersionMatch(string Data,MatchType Type);
  52. };
  53. #endif