]>
cygwin.com Git - cygwin-apps/setup.git/blob - PackageSpecification.cc
2 * Copyright (c) 2002, Robert Collins.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * A copy of the GNU General Public License can be found at
12 * Written by Robert Collins <rbtcollins@hotmail.com>
16 #include "PackageSpecification.h"
18 #include "package_version.h"
20 PackageSpecification::PackageSpecification (const std::string
& packageName
)
21 : _packageName (packageName
) , _operator (Equals
), _version ()
26 PackageSpecification::packageName () const
31 const PackageSpecification::_operators
32 PackageSpecification::op() const
38 PackageSpecification::version() const
44 PackageSpecification::setOperator (_operators anOperator
)
46 _operator
= anOperator
;
50 PackageSpecification::setVersion (const std::string
& aVersion
)
56 PackageSpecification::satisfies (packageversion
const &aPackage
) const
58 if (casecompare(_packageName
, aPackage
.Name()) != 0)
61 // The default values of _operator = Equals and _version is an empty-string
65 int comparison
= casecompare(aPackage
.Canonical_version (), _version
);
69 return (comparison
== 0);
71 return (comparison
< 0);
73 return (comparison
> 0);
75 return (comparison
<= 0);
77 return (comparison
>= 0);
86 operator << (std::ostream
&os
, PackageSpecification
const &spec
)
88 os
<< spec
._packageName
;
90 os
<< " " << PackageSpecification::caption(spec
._operator
) << " " << spec
._version
;
95 PackageSpecification::caption (_operators _value
)
110 // Pacify GCC: (all case options are checked above)
111 return "Unknown operator";
This page took 0.041955 seconds and 5 git commands to generate.