Translated using Weblate (Chinese (Simplified))
[cygwin-setup.git] / PackageSpecification.h
blobb8814948752813e6326b3a1bafa0a4e34aa01892
1 /*
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
10 * http://www.gnu.org/
12 * Written by Robert Collins <rbtcollins@hotmail.com>
16 #ifndef SETUP_PACKAGESPECIFICATION_H
17 #define SETUP_PACKAGESPECIFICATION_H
19 #include <iosfwd>
20 #include "String++.h"
22 class SolvableVersion;
23 typedef SolvableVersion packageversion;
25 /* Describe a package - i.e. we need version 5 of apt */
27 class PackageSpecification
29 public:
30 PackageSpecification () : _packageName (), _operator(Equals) {}
31 PackageSpecification (const std::string& packageName);
32 PackageSpecification (const std::string& packageName,
33 const std::string &packageVersion);
34 ~PackageSpecification () {}
36 enum _operators
38 Equals,
39 LessThan,
40 MoreThan,
41 LessThanEquals,
42 MoreThanEquals,
45 const std::string& packageName() const;
46 const _operators op() const;
47 const std::string& version() const;
49 void setOperator (_operators);
50 void setVersion (const std::string& );
52 bool satisfies (packageversion const &) const;
54 friend std::ostream &operator << (std::ostream &, PackageSpecification const &);
56 private:
57 static char const * caption (_operators _value);
59 std::string _packageName; /* foobar */
60 _operators _operator; /* >= */
61 std::string _version; /* 1.20 */
64 std::ostream &
65 operator << (std::ostream &os, PackageSpecification const &);
67 #endif /* SETUP_PACKAGESPECIFICATION_H */