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 #ifndef SETUP_PACKAGESPECIFICATION_H
17 #define SETUP_PACKAGESPECIFICATION_H
19 /* To parse this file */
24 /* Describe a package - i.e. we need version 5 of apt */
26 class PackageSpecification
29 PackageSpecification () : _packageName (), _operator(0) {}
30 PackageSpecification (String
const &packageName
);
31 ~PackageSpecification () {}
35 String
const& packageName() const;
36 void setOperator (_operators
const &);
37 void setVersion (String
const &);
39 bool satisfies (packageversion
const &) const;
40 String
serialise () const;
42 PackageSpecification
&operator= (PackageSpecification
const &);
44 friend std::ostream
&operator << (std::ostream
&, PackageSpecification
const &);
49 _operators ():_value (0) {};
50 _operators (int aInt
) {
52 if (_value
< 0 || _value
> 4)
55 _operators
& operator ++ ();
56 bool operator == (_operators
const &rhs
) { return _value
== rhs
._value
; }
57 bool operator != (_operators
const &rhs
) { return _value
!= rhs
._value
; }
58 const char *caption () const;
59 bool satisfies (String
const &lhs
, String
const &rhs
) const;
63 static const _operators Equals
;
64 static const _operators LessThan
;
65 static const _operators MoreThan
;
66 static const _operators LessThanEquals
;
67 static const _operators MoreThanEquals
;
70 String _packageName
; /* foobar */
71 _operators
const * _operator
; /* >= */
72 String _version
; /* 1.20 */
76 operator << (std::ostream
&os
, PackageSpecification
const &);
78 #endif /* SETUP_PACKAGESPECIFICATION_H */