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 #ifndef APT_8_CLEANER_HEADERS 00043 using std::string; 00044 #endif 00045 00046 class pkgVersionMatch 00047 { 00048 // Version Matching 00049 std::string VerStr; 00050 bool VerPrefixMatch; 00051 00052 // Release Matching 00053 std::string RelVerStr; 00054 bool RelVerPrefixMatch; 00055 std::string RelOrigin; 00056 std::string RelRelease; 00057 std::string RelCodename; 00058 std::string RelArchive; 00059 std::string RelLabel; 00060 std::string RelComponent; 00061 std::string RelArchitecture; 00062 bool MatchAll; 00063 00064 // Origin Matching 00065 std::string OrSite; 00066 00067 public: 00068 00069 enum MatchType {None = 0,Version,Release,Origin} Type; 00070 00071 bool MatchVer(const char *A,std::string B,bool Prefix); 00072 bool ExpressionMatches(const char *pattern, const char *string); 00073 bool ExpressionMatches(const std::string& pattern, const char *string); 00074 bool FileMatch(pkgCache::PkgFileIterator File); 00075 pkgCache::VerIterator Find(pkgCache::PkgIterator Pkg); 00076 00077 pkgVersionMatch(std::string Data,MatchType Type); 00078 }; 00079 00080 #endif