]> git.saurik.com Git - apt.git/blame - apt-pkg/versionmatch.h
Avoid extra inner copy in APT_MKSTRCMP and APT_MKSTRCMP2
[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=)
26 If there are no equals signs in the string then it is scanned in short
efc487fb
DK
27 form - if it starts with a number it is Version otherwise it is an
28 Archive or a Codename.
29
b2e465d6 30 Release may be a '*' to match all releases.
efc487fb 31
b2e465d6
AL
32 ##################################################################### */
33 /*}}}*/
34#ifndef PKGLIB_VERSIONMATCH_H
35#define PKGLIB_VERSIONMATCH_H
36
b2e465d6
AL
37
38#include <string>
39#include <apt-pkg/pkgcache.h>
40
0a843901
AL
41using std::string;
42
b2e465d6 43class pkgVersionMatch
0a843901 44{
b2e465d6
AL
45 // Version Matching
46 string VerStr;
47 bool VerPrefixMatch;
48
49 // Release Matching
50 string RelVerStr;
51 bool RelVerPrefixMatch;
52 string RelOrigin;
efc487fb
DK
53 string RelRelease;
54 string RelCodename;
b2e465d6
AL
55 string RelArchive;
56 string RelLabel;
57 string RelComponent;
0a5e4a03
AL
58 bool MatchAll;
59
b2e465d6
AL
60 // Origin Matching
61 string OrSite;
62
63 public:
64
65 enum MatchType {None = 0,Version,Release,Origin} Type;
66
67 bool MatchVer(const char *A,string B,bool Prefix);
68 bool FileMatch(pkgCache::PkgFileIterator File);
69 pkgCache::VerIterator Find(pkgCache::PkgIterator Pkg);
70
71 pkgVersionMatch(string Data,MatchType Type);
72};
73
74#endif