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(string::const_iterator, string::const_iterator);
33  CUPT_LOCAL void __init(string::const_iterator, string::const_iterator);
34  public:
36  struct Types
37  {
39  enum Type { Less, Equal, More, LessOrEqual, MoreOrEqual, None };
41  static const string strings[];
42  };
43  string packageName;
45  string versionString;
46 
48 
52  explicit Relation(const string& input);
54 
58  explicit Relation(pair< string::const_iterator, string::const_iterator > input);
59  Relation(Relation&&) = default;
60  Relation(const Relation&) = default;
61  Relation& operator=(Relation&&) = default;
62  Relation& operator=(const Relation&) = default;
64  virtual ~Relation();
66  string toString() const;
68 
75  bool isSatisfiedBy(const string& otherVersionString) const;
77 
81  bool operator==(const Relation& other) const;
82 };
83 
85 struct CUPT_API ArchitecturedRelation: public Relation
86 {
87  private:
88  CUPT_LOCAL void __init(string::const_iterator, string::const_iterator);
89  public:
91  vector< string > architectureFilters;
92 
94 
98  explicit ArchitecturedRelation(const string& input);
100 
105  ArchitecturedRelation(pair< string::const_iterator, string::const_iterator > input);
108  ArchitecturedRelation& operator=(ArchitecturedRelation&&) = default;
109  ArchitecturedRelation& operator=(const ArchitecturedRelation&) = default;
110  string toString() const;
111 };
112 
114 struct CUPT_API RelationExpression: public vector< Relation >
115 {
116  private:
117  CUPT_LOCAL void __init(string::const_iterator, string::const_iterator);
118  public:
120  string toString() const;
122  string getHashString() const;
124 
129 
132  explicit RelationExpression(const string& input);
134 
138  explicit RelationExpression(pair< string::const_iterator, string::const_iterator > input);
140  RelationExpression(const RelationExpression&) = default;
141  RelationExpression& operator=(RelationExpression&&) = default;
142  RelationExpression& operator=(const RelationExpression&) = default;
144  virtual ~RelationExpression();
145 };
146 
148 struct CUPT_API ArchitecturedRelationExpression: public vector< ArchitecturedRelation >
149 {
150  private:
151  CUPT_LOCAL void __init(string::const_iterator, string::const_iterator);
152  public:
154  string toString() const;
156 
161 
164  explicit ArchitecturedRelationExpression(const string& input);
166 
170  ArchitecturedRelationExpression(pair< string::const_iterator, string::const_iterator > input);
177 };
178 
180 struct CUPT_API RelationLine: public vector< RelationExpression >
181 {
182  private:
183  CUPT_LOCAL void __init(string::const_iterator, string::const_iterator);
184  public:
186  string toString() const;
188 
191  RelationLine();
193 
196  explicit RelationLine(const string& input);
198 
202  explicit RelationLine(pair< string::const_iterator, string::const_iterator > input);
203  RelationLine(RelationLine&&) = default;
204  RelationLine(const RelationLine&) = default;
205  RelationLine& operator=(RelationLine&&) = default;
206  RelationLine& operator=(const RelationLine&) = default;
208  virtual ~RelationLine();
209 };
210 
212 struct CUPT_API ArchitecturedRelationLine: public vector< ArchitecturedRelationExpression >
213 {
214  private:
215  CUPT_LOCAL void __init(string::const_iterator, string::const_iterator);
216  public:
218  string toString() const;
220 
225 
228  explicit ArchitecturedRelationLine(const string& input);
230 
234  explicit ArchitecturedRelationLine(pair< string::const_iterator, string::const_iterator > input);
238  ArchitecturedRelationLine& operator=(const ArchitecturedRelationLine&) = default;
240 
249  RelationLine toRelationLine(const string& currentArchitecture) const;
251  virtual ~ArchitecturedRelationLine();
252 };
253 
254 }
255 }
256 
257 #endif
258