version_spec.hh
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PALUDIS_GUARD_PALUDIS_VERSION_SPEC_HH
00021 #define PALUDIS_GUARD_PALUDIS_VERSION_SPEC_HH 1
00022
00023 #include <paludis/version_spec-fwd.hh>
00024 #include <paludis/util/exception.hh>
00025 #include <paludis/util/private_implementation_pattern.hh>
00026 #include <paludis/util/operators.hh>
00027 #include <paludis/util/named_value.hh>
00028 #include <paludis/util/wrapped_forward_iterator-fwd.hh>
00029
00030 #include <iosfwd>
00031 #include <string>
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 namespace paludis
00045 {
00046
00047
00048
00049
00050
00051
00052 class PALUDIS_VISIBLE BadVersionSpecError :
00053 public NameError
00054 {
00055 public:
00056
00057
00058
00059 BadVersionSpecError(const std::string & name) throw ();
00060 BadVersionSpecError(const std::string & name, const std::string & msg) throw ();
00061
00062
00063 };
00064
00065 namespace n
00066 {
00067 struct number_value;
00068 struct text;
00069 struct type;
00070 }
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095 struct VersionSpecComponent
00096 {
00097 NamedValue<n::number_value, std::string> number_value;
00098 NamedValue<n::text, std::string> text;
00099 NamedValue<n::type, VersionSpecComponentType> type;
00100 };
00101
00102
00103
00104
00105
00106
00107 class PALUDIS_VISIBLE VersionSpec :
00108 private PrivateImplementationPattern<VersionSpec>,
00109 public relational_operators::HasRelationalOperators
00110 {
00111 friend std::ostream & operator<< (std::ostream &, const VersionSpec &);
00112
00113 public:
00114
00115
00116
00117
00118
00119
00120 explicit VersionSpec(const std::string & text);
00121
00122
00123
00124
00125 VersionSpec(const VersionSpec & other);
00126
00127
00128
00129
00130 ~VersionSpec();
00131
00132
00133
00134
00135 const VersionSpec & operator= (const VersionSpec & other);
00136
00137 std::size_t hash() const PALUDIS_ATTRIBUTE((warn_unused_result));
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147 bool tilde_compare(const VersionSpec & other) const;
00148
00149
00150
00151
00152 bool tilde_greater_compare(const VersionSpec & other) const;
00153
00154
00155
00156
00157 bool equal_star_compare(const VersionSpec & other) const;
00158
00159
00160
00161
00162 int compare(const VersionSpec & other) const;
00163
00164 bool operator== (const VersionSpec &) const;
00165
00166 bool operator< (const VersionSpec &) const;
00167
00168
00169
00170
00171
00172
00173 VersionSpec remove_revision() const;
00174
00175
00176
00177
00178 std::string revision_only() const;
00179
00180
00181
00182
00183
00184
00185
00186
00187 VersionSpec bump() const;
00188
00189
00190
00191
00192 bool is_scm() const;
00193
00194
00195
00196
00197 bool has_try_part() const;
00198
00199
00200
00201
00202
00203
00204 bool has_scm_part() const;
00205
00206
00207
00208
00209 bool has_local_revision() const;
00210
00211 struct ConstIteratorTag;
00212 typedef WrappedForwardIterator<ConstIteratorTag, const VersionSpecComponent> ConstIterator;
00213 ConstIterator begin() const;
00214 ConstIterator end() const;
00215 };
00216 }
00217
00218 #endif