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