// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: versionmatch.cc,v 1.2 2001/02/20 07:03:17 jgg Exp $
+// $Id: versionmatch.cc,v 1.6 2001/06/10 01:57:45 jgg Exp $
/* ######################################################################
Version Matching
#include <apt-pkg/error.h>
#include <stdio.h>
+#include <ctype.h>
/*}}}*/
// VersionMatch::pkgVersionMatch - Constructor /*{{{*/
/* Break up the data string according to the selected type */
pkgVersionMatch::pkgVersionMatch(string Data,MatchType Type) : Type(Type)
{
+ MatchAll = false;
+ VerPrefixMatch = false;
+ RelVerPrefixMatch = false;
+
if (Type == None || Data.length() < 1)
return;
if (Data.end()[-1] == '*')
{
VerPrefixMatch = true;
- VerStr = string(Data.begin(),Data.end()-1);
+ VerStr = string(Data,0,Data.length()-1);
}
else
VerStr = Data;
{
// All empty = match all
if (Data == "*")
+ {
+ MatchAll = true;
return;
+ }
// Are we a simple specification?
- const char *I = Data.begin();
- for (; I < Data.end() && *I != '='; I++);
+ string::const_iterator I = Data.begin();
+ for (; I != Data.end() && *I != '='; I++);
if (I == Data.end())
{
// Temporary
return false;
// Match (leading?)
- if (stringcasecmp(B.begin(),B.end(),
- Ab,Ab + B.length()) == 0)
+ if (stringcasecmp(B,Ab,Ab + B.length()) == 0)
return true;
return false;
{
if (Type == Release)
{
+ if (MatchAll == true)
+ return true;
+
/* cout << RelVerStr << ',' << RelOrigin << ',' << RelArchive << ',' << RelLabel << endl;
- cout << File.Version() << ',' << File.Origin() << ',' << File.Archive() << ',' << File.Label() << endl;
-*/
+ cout << File.Version() << ',' << File.Origin() << ',' << File.Archive() << ',' << File.Label() << endl;*/
+
if (RelVerStr.empty() == true && RelOrigin.empty() == true &&
RelArchive.empty() == true && RelLabel.empty() == true &&
RelComponent.empty() == true)
return false;
if (RelComponent.empty() == false)
if (File->Component == 0 ||
- stringcasecmp(RelLabel,File.Component()) != 0)
+ stringcasecmp(RelComponent,File.Component()) != 0)
return false;
return true;
}