]> git.saurik.com Git - apt.git/blame - apt-pkg/versionmatch.h
Merge commit 'e2073b0276226b625897ef475f225bf8f508719e' as 'triehash'
[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
453b82a3
DK
38#include <apt-pkg/pkgcache.h>
39#include <apt-pkg/cacheiterators.h>
b2e465d6
AL
40
41#include <string>
b2e465d6 42
a4f6bdc8
DK
43#ifndef APT_8_CLEANER_HEADERS
44using std::string;
45#endif
46
b2e465d6 47class pkgVersionMatch
a02db58f 48{
b2e465d6 49 // Version Matching
8f3ba4e8 50 std::string VerStr;
b2e465d6
AL
51 bool VerPrefixMatch;
52
53 // Release Matching
8f3ba4e8 54 std::string RelVerStr;
b2e465d6 55 bool RelVerPrefixMatch;
8f3ba4e8
DK
56 std::string RelOrigin;
57 std::string RelRelease;
58 std::string RelCodename;
59 std::string RelArchive;
60 std::string RelLabel;
61 std::string RelComponent;
62 std::string RelArchitecture;
0a5e4a03 63 bool MatchAll;
a02db58f 64
b2e465d6 65 // Origin Matching
8f3ba4e8 66 std::string OrSite;
a02db58f 67
b2e465d6 68 public:
a02db58f 69
b2e465d6 70 enum MatchType {None = 0,Version,Release,Origin} Type;
a02db58f
DK
71
72 bool MatchVer(const char *A,std::string B,bool Prefix) APT_PURE;
b07aeb1a
DK
73 static bool ExpressionMatches(const char *pattern, const char *string);
74 static bool ExpressionMatches(const std::string& pattern, const char *string);
b2e465d6
AL
75 bool FileMatch(pkgCache::PkgFileIterator File);
76 pkgCache::VerIterator Find(pkgCache::PkgIterator Pkg);
5bfd306e 77 bool VersionMatches(pkgCache::VerIterator Ver);
a02db58f 78
8f3ba4e8 79 pkgVersionMatch(std::string Data,MatchType Type);
b2e465d6
AL
80};
81
82#endif