Cupt
relation.hpp
Go to the documentation of this file.
1 /**************************************************************************
2 * Copyright (C) 2010 by Eugene V. Lyubimkin *
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 *
6 * (version 3 or above) as published by the Free Software Foundation. *
7 * *
8 * This program is distributed in the hope that it will be useful, *
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
11 * GNU General Public License for more details. *
12 * *
13 * You should have received a copy of the GNU GPL *
14 * along with this program; if not, write to the *
15 * Free Software Foundation, Inc., *
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA *
17 **************************************************************************/
18 #ifndef CUPT_CACHE_RELATION_SEEN
19 #define CUPT_CACHE_RELATION_SEEN
20 
22 
23 #include <cupt/common.hpp>
24 
25 namespace cupt {
26 namespace cache {
27 
29 struct CUPT_API Relation
30 {
31  private:
32  CUPT_LOCAL bool __parse_versioned_info(const char*, const char*);
33  CUPT_LOCAL void __init(const char*, const char*);
34  public:
36  struct Types
37  {
39  enum Type { Less, Equal, More, LessOrEqual, MoreOrEqual, LiteralyEqual, None };
41  static const string strings[];
42  };
43  string packageName;
45  string versionString;
46 
48 
52  explicit Relation(pair< const char*, const char* > input);
53  Relation(Relation&&) = default;
54  Relation(const Relation&) = default;
55  Relation& operator=(Relation&&) = default;
56  Relation& operator=(const Relation&) = default;
58  virtual ~Relation();
60  string toString() const;
62 
69  bool isSatisfiedBy(const string& otherVersionString) const;
71 
75  bool operator==(const Relation& other) const;
76 };
77 
79 struct CUPT_API ArchitecturedRelation: public Relation
80 {
81  private:
82  CUPT_LOCAL void __init(const char*, const char*);
83  public:
85  vector< string > architectureFilters;
86 
88 
93  explicit ArchitecturedRelation(pair< const char*, const char* > input);
96  ArchitecturedRelation& operator=(ArchitecturedRelation&&) = default;
97  ArchitecturedRelation& operator=(const ArchitecturedRelation&) = default;
98  string toString() const;
99 };
100 
102 struct CUPT_API RelationExpression: public vector< Relation >
103 {
104  private:
105  CUPT_LOCAL void __init(const char*, const char*);
106  public:
108  string toString() const;
110  string getHashString() const;
112 
117 
120  explicit RelationExpression(const string& input);
122 
126  explicit RelationExpression(pair< const char*, const char* > input);
128  RelationExpression(const RelationExpression&) = default;
129  RelationExpression& operator=(RelationExpression&&) = default;
130  RelationExpression& operator=(const RelationExpression&) = default;
132  virtual ~RelationExpression();
133 };
134 
136 struct CUPT_API ArchitecturedRelationExpression: public vector< ArchitecturedRelation >
137 {
138  private:
139  CUPT_LOCAL void __init(const char*, const char*);
140  public:
142  string toString() const;
144 
149 
152  explicit ArchitecturedRelationExpression(const string& input);
154 
158  explicit ArchitecturedRelationExpression(pair< const char*, const char* > input);
165 };
166 
168 struct CUPT_API RelationLine: public vector< RelationExpression >
169 {
170  private:
171  CUPT_LOCAL void __init(const char*, const char*);
172  public:
174  string toString() const;
176 
179  RelationLine();
181 
184  explicit RelationLine(const string& input);
186 
190  explicit RelationLine(pair< const char*, const char* > input);
191  RelationLine(RelationLine&&) = default;
192  RelationLine(const RelationLine&) = default;
193  RelationLine& operator=(RelationLine&&);
194  RelationLine& operator=(const RelationLine&) = default;
196  virtual ~RelationLine();
197 };
198 
200 struct CUPT_API ArchitecturedRelationLine: public vector< ArchitecturedRelationExpression >
201 {
202  private:
203  CUPT_LOCAL void __init(const char*, const char*);
204  public:
206  string toString() const;
208 
213 
216  explicit ArchitecturedRelationLine(const string& input);
218 
222  explicit ArchitecturedRelationLine(pair< const char*, const char* > input);
226  ArchitecturedRelationLine& operator=(const ArchitecturedRelationLine&) = default;
228 
237  RelationLine toRelationLine(const string& currentArchitecture) const;
239  virtual ~ArchitecturedRelationLine();
240 };
241 
242 }
243 }
244 
245 #endif
246 
Type
type
Definition: relation.hpp:39
Types::Type relationType
relation type
Definition: relation.hpp:44
Definition: binarypackage.hpp:26
group of alternative architectured relation expressions
Definition: relation.hpp:136
string packageName
package name
Definition: relation.hpp:43
array of relation expressions
Definition: relation.hpp:168
relation type
Definition: relation.hpp:36
relation with optional architecture filters
Definition: relation.hpp:79
vector< string > architectureFilters
architecture filters
Definition: relation.hpp:85
relation against certain binary package
Definition: relation.hpp:29
group of alternative relations
Definition: relation.hpp:102
array of architectured relation expressions
Definition: relation.hpp:200
string versionString
version string
Definition: relation.hpp:45