]> cygwin.com Git - cygwin-apps/setup.git/blob - PackageSpecification.h
Drop in SolvableVersion as a replacement for packageversion
[cygwin-apps/setup.git] / PackageSpecification.h
1 /*
2 * Copyright (c) 2002, Robert Collins.
3 *
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.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by Robert Collins <rbtcollins@hotmail.com>
13 *
14 */
15
16 #ifndef SETUP_PACKAGESPECIFICATION_H
17 #define SETUP_PACKAGESPECIFICATION_H
18
19 #include <iosfwd>
20 #include "String++.h"
21
22 class SolvableVersion;
23 typedef SolvableVersion packageversion;
24
25 /* Describe a package - i.e. we need version 5 of apt */
26
27 class PackageSpecification
28 {
29 public:
30 PackageSpecification () : _packageName (), _operator(Equals) {}
31 PackageSpecification (const std::string& packageName);
32 ~PackageSpecification () {}
33
34 enum _operators
35 {
36 Equals,
37 LessThan,
38 MoreThan,
39 LessThanEquals,
40 MoreThanEquals,
41 };
42
43 const std::string& packageName() const;
44 const _operators op() const;
45 const std::string& version() const;
46
47 void setOperator (_operators);
48 void setVersion (const std::string& );
49
50 bool satisfies (packageversion const &) const;
51
52 friend std::ostream &operator << (std::ostream &, PackageSpecification const &);
53
54 private:
55 static char const * caption (_operators _value);
56
57 std::string _packageName; /* foobar */
58 _operators _operator; /* >= */
59 std::string _version; /* 1.20 */
60 };
61
62 std::ostream &
63 operator << (std::ostream &os, PackageSpecification const &);
64
65 #endif /* SETUP_PACKAGESPECIFICATION_H */
This page took 0.033531 seconds and 5 git commands to generate.