apt @VERSION@
|
00001 // -*- mode: cpp; mode: fold -*- 00002 // Description /*{{{*/ 00003 // $Id: versionmatch.h,v 1.4 2001/05/29 03:07:12 jgg Exp $ 00004 /* ###################################################################### 00005 00006 Version Matching 00007 00008 This module takes a matching string and a type and locates the version 00009 record that satisfies the constraint described by the matching string. 00010 00011 Version: 1.2* 00012 Release: o=Debian,v=2.1*,c=main 00013 Release: v=2.1* 00014 Release: a=testing 00015 Release: n=squeeze 00016 Release: * 00017 Origin: ftp.debian.org 00018 00019 Release may be a complex type that can specify matches for any of: 00020 Version (v= with prefix) 00021 Origin (o=) 00022 Archive (a=) eg, unstable, testing, stable 00023 Codename (n=) e.g. etch, lenny, squeeze, sid 00024 Label (l=) 00025 Component (c=) 00026 Binary Architecture (b=) 00027 If there are no equals signs in the string then it is scanned in short 00028 form - if it starts with a number it is Version otherwise it is an 00029 Archive or a Codename. 00030 00031 Release may be a '*' to match all releases. 00032 00033 ##################################################################### */ 00034 /*}}}*/ 00035 #ifndef PKGLIB_VERSIONMATCH_H 00036 #define PKGLIB_VERSIONMATCH_H 00037 00038 00039 #include <string> 00040 #include <apt-pkg/pkgcache.h> 00041 00042 using std::string; 00043 00044 class pkgVersionMatch 00045 { 00046 // Version Matching 00047 string VerStr; 00048 bool VerPrefixMatch; 00049 00050 // Release Matching 00051 string RelVerStr; 00052 bool RelVerPrefixMatch; 00053 string RelOrigin; 00054 string RelRelease; 00055 string RelCodename; 00056 string RelArchive; 00057 string RelLabel; 00058 string RelComponent; 00059 string RelArchitecture; 00060 bool MatchAll; 00061 00062 // Origin Matching 00063 string OrSite; 00064 00065 public: 00066 00067 enum MatchType {None = 0,Version,Release,Origin} Type; 00068 00069 bool MatchVer(const char *A,string B,bool Prefix); 00070 bool ExpressionMatches(const char *pattern, const char *string); 00071 bool ExpressionMatches(const std::string& pattern, const char *string); 00072 bool FileMatch(pkgCache::PkgFileIterator File); 00073 pkgCache::VerIterator Find(pkgCache::PkgIterator Pkg); 00074 00075 pkgVersionMatch(string Data,MatchType Type); 00076 }; 00077 00078 #endif