versionmatch.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: versionmatch.h,v 1.3 2001/05/07 04:24:08 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. // Origin Matching
  46. string OrSite;
  47. public:
  48. enum MatchType {None = 0,Version,Release,Origin} Type;
  49. bool MatchVer(const char *A,string B,bool Prefix);
  50. bool FileMatch(pkgCache::PkgFileIterator File);
  51. pkgCache::VerIterator Find(pkgCache::PkgIterator Pkg);
  52. pkgVersionMatch(string Data,MatchType Type);
  53. };
  54. #endif