versionmatch.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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: a=testing
  12. Release: n=squeeze
  13. Release: *
  14. Origin: ftp.debian.org
  15. Release may be a complex type that can specify matches for any of:
  16. Version (v= with prefix)
  17. Origin (o=)
  18. Archive (a=) eg, unstable, testing, stable
  19. Codename (n=) e.g. etch, lenny, squeeze, sid
  20. Label (l=)
  21. Component (c=)
  22. If there are no equals signs in the string then it is scanned in short
  23. form - if it starts with a number it is Version otherwise it is an
  24. Archive or a Codename.
  25. Release may be a '*' to match all releases.
  26. ##################################################################### */
  27. /*}}}*/
  28. #ifndef PKGLIB_VERSIONMATCH_H
  29. #define PKGLIB_VERSIONMATCH_H
  30. #include <string>
  31. #include <apt-pkg/pkgcache.h>
  32. using std::string;
  33. class pkgVersionMatch
  34. {
  35. // Version Matching
  36. string VerStr;
  37. bool VerPrefixMatch;
  38. // Release Matching
  39. string RelVerStr;
  40. bool RelVerPrefixMatch;
  41. string RelOrigin;
  42. string RelRelease;
  43. string RelCodename;
  44. string RelArchive;
  45. string RelLabel;
  46. string RelComponent;
  47. bool MatchAll;
  48. // Origin Matching
  49. string OrSite;
  50. public:
  51. enum MatchType {None = 0,Version,Release,Origin} Type;
  52. bool MatchVer(const char *A,string B,bool Prefix);
  53. bool FileMatch(pkgCache::PkgFileIterator File);
  54. pkgCache::VerIterator Find(pkgCache::PkgIterator Pkg);
  55. pkgVersionMatch(string Data,MatchType Type);
  56. };
  57. #endif