versionmatch.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. #ifdef __GNUG__
  28. #pragma interface "apt-pkg/versionmatch.h"
  29. #endif
  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 RelArchive;
  43. string RelLabel;
  44. string RelComponent;
  45. bool MatchAll;
  46. // Origin Matching
  47. string OrSite;
  48. public:
  49. enum MatchType {None = 0,Version,Release,Origin} Type;
  50. bool MatchVer(const char *A,string B,bool Prefix);
  51. bool FileMatch(pkgCache::PkgFileIterator File);
  52. pkgCache::VerIterator Find(pkgCache::PkgIterator Pkg);
  53. pkgVersionMatch(string Data,MatchType Type);
  54. };
  55. #endif