]> git.saurik.com Git - apt.git/blob - apt-pkg/versionmatch.h
merged from debian-experimental2
[apt.git] / apt-pkg / versionmatch.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: versionmatch.h,v 1.4 2001/05/29 03:07:12 jgg Exp $
4 /* ######################################################################
5
6 Version Matching
7
8 This module takes a matching string and a type and locates the version
9 record that satisfies the constraint described by the matching string.
10
11 Version: 1.2*
12 Release: o=Debian,v=2.1*,c=main
13 Release: v=2.1*
14 Release: a=testing
15 Release: n=squeeze
16 Release: *
17 Origin: ftp.debian.org
18
19 Release may be a complex type that can specify matches for any of:
20 Version (v= with prefix)
21 Origin (o=)
22 Archive (a=) eg, unstable, testing, stable
23 Codename (n=) e.g. etch, lenny, squeeze, sid
24 Label (l=)
25 Component (c=)
26 Binary Architecture (b=)
27 If there are no equals signs in the string then it is scanned in short
28 form - if it starts with a number it is Version otherwise it is an
29 Archive or a Codename.
30
31 Release may be a '*' to match all releases.
32
33 ##################################################################### */
34 /*}}}*/
35 #ifndef PKGLIB_VERSIONMATCH_H
36 #define PKGLIB_VERSIONMATCH_H
37
38
39 #include <string>
40 #include <apt-pkg/pkgcache.h>
41
42 #ifndef APT_8_CLEANER_HEADERS
43 using std::string;
44 #endif
45
46 class pkgVersionMatch
47 {
48 // Version Matching
49 std::string VerStr;
50 bool VerPrefixMatch;
51
52 // Release Matching
53 std::string RelVerStr;
54 bool RelVerPrefixMatch;
55 std::string RelOrigin;
56 std::string RelRelease;
57 std::string RelCodename;
58 std::string RelArchive;
59 std::string RelLabel;
60 std::string RelComponent;
61 std::string RelArchitecture;
62 bool MatchAll;
63
64 // Origin Matching
65 std::string OrSite;
66
67 public:
68
69 enum MatchType {None = 0,Version,Release,Origin} Type;
70
71 bool MatchVer(const char *A,std::string B,bool Prefix);
72 bool ExpressionMatches(const char *pattern, const char *string);
73 bool ExpressionMatches(const std::string& pattern, const char *string);
74 bool FileMatch(pkgCache::PkgFileIterator File);
75 pkgCache::VerIterator Find(pkgCache::PkgIterator Pkg);
76
77 pkgVersionMatch(std::string Data,MatchType Type);
78 };
79
80 #endif