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