|
Cupt
|
00001 /************************************************************************** 00002 * Copyright (C) 2010 by Eugene V. Lyubimkin * 00003 * * 00004 * This program is free software; you can redistribute it and/or modify * 00005 * it under the terms of the GNU General Public License * 00006 * (version 3 or above) as published by the Free Software Foundation. * 00007 * * 00008 * This program is distributed in the hope that it will be useful, * 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00011 * GNU General Public License for more details. * 00012 * * 00013 * You should have received a copy of the GNU GPL * 00014 * along with this program; if not, write to the * 00015 * Free Software Foundation, Inc., * 00016 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * 00017 **************************************************************************/ 00018 #ifndef CUPT_CACHE_RELATION_SEEN 00019 #define CUPT_CACHE_RELATION_SEEN 00020 00022 00023 #include <cupt/common.hpp> 00024 00025 namespace cupt { 00026 namespace cache { 00027 00029 struct CUPT_API Relation 00030 { 00031 private: 00032 CUPT_LOCAL bool __parse_versioned_info(string::const_iterator, string::const_iterator); 00033 CUPT_LOCAL void __init(string::const_iterator, string::const_iterator); 00034 public: 00036 struct Types 00037 { 00039 enum Type { Less, Equal, More, LessOrEqual, MoreOrEqual, None }; 00041 static const string strings[]; 00042 }; 00043 string packageName; 00044 Types::Type relationType; 00045 string versionString; 00046 00048 00052 explicit Relation(const string& input); 00054 00058 explicit Relation(pair< string::const_iterator, string::const_iterator > input); 00060 Relation(Relation&&); 00062 virtual ~Relation(); 00064 string toString() const; 00066 00073 bool isSatisfiedBy(const string& otherVersionString) const; 00075 00079 bool operator==(const Relation& other) const; 00080 }; 00081 00083 struct CUPT_API ArchitecturedRelation: public Relation 00084 { 00085 private: 00086 CUPT_LOCAL void __init(string::const_iterator, string::const_iterator); 00087 public: 00089 vector< string > architectureFilters; 00090 00092 00096 explicit ArchitecturedRelation(const string& input); 00098 00103 ArchitecturedRelation(pair< string::const_iterator, string::const_iterator > input); 00104 ArchitecturedRelation(ArchitecturedRelation&&); 00105 string toString() const; 00106 }; 00107 00109 struct CUPT_API RelationExpression: public vector< Relation > 00110 { 00111 private: 00112 CUPT_LOCAL void __init(string::const_iterator, string::const_iterator); 00113 public: 00115 string toString() const; 00117 string getHashString() const; 00119 00122 RelationExpression(); 00124 00127 explicit RelationExpression(const string& input); 00129 00133 explicit RelationExpression(pair< string::const_iterator, string::const_iterator > input); 00135 RelationExpression(RelationExpression&&); 00137 virtual ~RelationExpression(); 00138 }; 00139 00141 struct CUPT_API ArchitecturedRelationExpression: public vector< ArchitecturedRelation > 00142 { 00143 private: 00144 CUPT_LOCAL void __init(string::const_iterator, string::const_iterator); 00145 public: 00147 string toString() const; 00149 00152 ArchitecturedRelationExpression(); 00154 00157 explicit ArchitecturedRelationExpression(const string& input); 00159 00163 ArchitecturedRelationExpression(pair< string::const_iterator, string::const_iterator > input); 00165 ArchitecturedRelationExpression(ArchitecturedRelationExpression&&); 00167 virtual ~ArchitecturedRelationExpression(); 00168 }; 00169 00171 struct CUPT_API RelationLine: public vector< RelationExpression > 00172 { 00173 private: 00174 CUPT_LOCAL void __init(string::const_iterator, string::const_iterator); 00175 public: 00177 string toString() const; 00179 00182 RelationLine(); 00184 00187 explicit RelationLine(const string& input); 00189 00193 explicit RelationLine(pair< string::const_iterator, string::const_iterator > input); 00195 RelationLine& operator=(RelationLine&& other); 00197 virtual ~RelationLine(); 00198 }; 00199 00201 struct CUPT_API ArchitecturedRelationLine: public vector< ArchitecturedRelationExpression > 00202 { 00203 private: 00204 CUPT_LOCAL void __init(string::const_iterator, string::const_iterator); 00205 public: 00207 string toString() const; 00209 00212 ArchitecturedRelationLine(); 00214 00217 explicit ArchitecturedRelationLine(const string& input); 00219 00223 explicit ArchitecturedRelationLine(pair< string::const_iterator, string::const_iterator > input); 00225 ArchitecturedRelationLine& operator=(ArchitecturedRelationLine&&); 00227 00236 RelationLine toRelationLine(const string& currentArchitecture) const; 00238 virtual ~ArchitecturedRelationLine(); 00239 }; 00240 00241 } 00242 } 00243 00244 #endif 00245
1.7.4