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 const char* p_parsePackagePart(const char*, const char*);
34  CUPT_LOCAL void __init(const char*, const char*);
35  public:
37  struct Types
38  {
40  enum Type { Less, Equal, More, LessOrEqual, MoreOrEqual, LiteralyEqual, None };
42  static const string strings[];
43  };
44  string packageName;
45  string architecture;
46  Types::Type relationType;
47  string versionString;
48 
50 
54  explicit Relation(pair< const char*, const char* > input);
55  Relation(Relation&&) = default;
56  Relation(const Relation&) = default;
57  Relation& operator=(Relation&&) = default;
58  Relation& operator=(const Relation&) = default;
60  virtual ~Relation();
62  string toString() const;
64 
71  bool isSatisfiedBy(const string& otherVersionString) const;
73 
77  bool operator==(const Relation& other) const;
78 };
79 
81 struct CUPT_API ArchitecturedRelation: public Relation
82 {
83  private:
84  CUPT_LOCAL void __init(const char*, const char*);
85  public:
87  vector< string > architectureFilters;
88 
90 
95  explicit ArchitecturedRelation(pair< const char*, const char* > input);
98  ArchitecturedRelation& operator=(ArchitecturedRelation&&) = default;
99  ArchitecturedRelation& operator=(const ArchitecturedRelation&) = default;
100  string toString() const;
101 };
102 
104 struct CUPT_API RelationExpression: public vector< Relation >
105 {
106  private:
107  CUPT_LOCAL void __init(const char*, const char*);
108  public:
110  string toString() const;
112  string getHashString() const;
114 
119 
122  explicit RelationExpression(const string& input);
124 
128  explicit RelationExpression(pair< const char*, const char* > input);
130  RelationExpression(const RelationExpression&) = default;
131  RelationExpression& operator=(RelationExpression&&) = default;
132  RelationExpression& operator=(const RelationExpression&) = default;
134  virtual ~RelationExpression();
135 };
136 
138 struct CUPT_API ArchitecturedRelationExpression: public vector< ArchitecturedRelation >
139 {
140  private:
141  CUPT_LOCAL void __init(const char*, const char*);
142  public:
144  string toString() const;
146 
151 
154  explicit ArchitecturedRelationExpression(const string& input);
156 
160  explicit ArchitecturedRelationExpression(pair< const char*, const char* > input);
167 };
168 
170 struct CUPT_API RelationLine: public vector< RelationExpression >
171 {
172  private:
173  CUPT_LOCAL void __init(const char*, const char*);
174  public:
176  string toString() const;
178 
181  RelationLine();
183 
186  explicit RelationLine(const string& input);
188 
192  explicit RelationLine(pair< const char*, const char* > input);
193  RelationLine(RelationLine&&) = default;
194  RelationLine(const RelationLine&) = default;
195  RelationLine& operator=(RelationLine&&);
196  RelationLine& operator=(const RelationLine&) = default;
198  virtual ~RelationLine();
199 };
200 
202 struct CUPT_API ArchitecturedRelationLine: public vector< ArchitecturedRelationExpression >
203 {
204  private:
205  CUPT_LOCAL void __init(const char*, const char*);
206  public:
208  string toString() const;
210 
215 
218  explicit ArchitecturedRelationLine(const string& input);
220 
224  explicit ArchitecturedRelationLine(pair< const char*, const char* > input);
228  ArchitecturedRelationLine& operator=(const ArchitecturedRelationLine&) = default;
230 
239  RelationLine toRelationLine(const string& currentArchitecture) const;
241  virtual ~ArchitecturedRelationLine();
242 };
243 
244 }
245 }
246 
247 #endif
248 
Type
type
Definition: relation.hpp:40
Definition: binarypackage.hpp:26
group of alternative architectured relation expressions
Definition: relation.hpp:138
array of relation expressions
Definition: relation.hpp:170
relation type
Definition: relation.hpp:37
relation with optional architecture filters
Definition: relation.hpp:81
vector< string > architectureFilters
architecture filters
Definition: relation.hpp:87
relation against certain binary package
Definition: relation.hpp:29
group of alternative relations
Definition: relation.hpp:104
array of architectured relation expressions
Definition: relation.hpp:202