versionmatch.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: versionmatch.h,v 1.4 2001/05/29 03:07:12 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. #include <string>
  28. #include <apt-pkg/pkgcache.h>
  29. using std::string;
  30. class pkgVersionMatch
  31. {
  32. // Version Matching
  33. string VerStr;
  34. bool VerPrefixMatch;
  35. // Release Matching
  36. string RelVerStr;
  37. bool RelVerPrefixMatch;
  38. string RelOrigin;
  39. string RelArchive;
  40. string RelLabel;
  41. string RelComponent;
  42. bool MatchAll;
  43. // Origin Matching
  44. string OrSite;
  45. public:
  46. enum MatchType {None = 0,Version,Release,Origin} Type;
  47. bool MatchVer(const char *A,string B,bool Prefix);
  48. bool FileMatch(pkgCache::PkgFileIterator File);
  49. pkgCache::VerIterator Find(pkgCache::PkgIterator Pkg);
  50. pkgVersionMatch(string Data,MatchType Type);
  51. };
  52. #endif