12#ifndef ZYPP_IDSTRINGTYPE_H
13#define ZYPP_IDSTRINGTYPE_H
85 template <
class Derived>
98 const Derived &
self()
const {
return *
static_cast<const Derived*
>( this ); }
113 {
return !
empty(); }
120 explicit operator std::string()
const
127 static int compare(
const Derived & lhs,
const Derived & rhs ) {
return compare( lhs.idStr(), rhs.idStr() ); }
129 static int compare(
const Derived & lhs,
const std::string & rhs ) {
return compare( lhs.idStr(), rhs.c_str() ); }
130 static int compare(
const Derived & lhs,
const char * rhs ) {
return compare( lhs.idStr(), rhs );}
133 static int compare(
const IdString & lhs,
const IdString & rhs ) {
return lhs == rhs ? 0 : Derived::_doCompare( (lhs ? lhs.
c_str() : (
const char *)0 ),
134 (rhs ? rhs.
c_str() : (
const char *)0 ) ); }
136 static int compare(
const IdString & lhs,
const char * rhs ) {
return Derived::_doCompare( (lhs ? lhs.
c_str() : (
const char *)0 ), rhs ); }
138 static int compare(
const std::string & lhs,
const Derived & rhs ) {
return compare( lhs.c_str(), rhs.idStr() ); }
140 static int compare(
const std::string & lhs,
const std::string & rhs ) {
return compare( lhs.c_str(), rhs.c_str() ); }
141 static int compare(
const std::string & lhs,
const char * rhs ) {
return compare( lhs.c_str(), rhs ); }
143 static int compare(
const char * lhs,
const Derived & rhs ) {
return compare( lhs, rhs.idStr() ); }
144 static int compare(
const char * lhs,
const IdString & rhs ) {
return Derived::_doCompare( lhs, (rhs ? rhs.
c_str() : (
const char *)0 ) ); }
145 static int compare(
const char * lhs,
const std::string & rhs ) {
return compare( lhs, rhs.c_str() ); }
146 static int compare(
const char * lhs,
const char * rhs ) {
return Derived::_doCompare( lhs, rhs ); }
158 if ( ! lhs )
return rhs ? -1 : 0;
159 return rhs ? ::strcmp( lhs, rhs ) : 1;
165 template <
class Derived>
170 template <
class Derived>
172 {
return lhs.
compare( rhs ) == 0; }
174 template <
class Derived>
176 {
return lhs.
compare( rhs ) == 0; }
178 template <
class Derived>
180 {
return lhs.
compare( rhs ) == 0; }
182 template <
class Derived>
184 {
return lhs.
compare( rhs ) == 0; }
186 template <
class Derived>
188 {
return rhs.
compare( lhs ) == 0; }
190 template <
class Derived>
192 {
return rhs.
compare( lhs ) == 0; }
194 template <
class Derived>
196 {
return rhs.
compare( lhs ) == 0; }
199 template <
class Derived>
201 {
return lhs.
compare( rhs ) != 0; }
203 template <
class Derived>
205 {
return lhs.
compare( rhs ) != 0; }
207 template <
class Derived>
209 {
return lhs.
compare( rhs ) != 0; }
211 template <
class Derived>
213 {
return lhs.
compare( rhs ) != 0; }
215 template <
class Derived>
217 {
return rhs.
compare( lhs ) != 0; }
219 template <
class Derived>
221 {
return rhs.
compare( lhs ) != 0; }
223 template <
class Derived>
225 {
return rhs.
compare( lhs ) != 0; }
228 template <
class Derived>
230 {
return lhs.
compare( rhs ) < 0; }
232 template <
class Derived>
234 {
return lhs.
compare( rhs ) < 0; }
236 template <
class Derived>
238 {
return lhs.
compare( rhs ) < 0; }
240 template <
class Derived>
242 {
return lhs.
compare( rhs ) < 0; }
244 template <
class Derived>
246 {
return rhs.
compare( lhs ) >= 0; }
248 template <
class Derived>
250 {
return rhs.
compare( lhs ) >= 0; }
252 template <
class Derived>
254 {
return rhs.
compare( lhs ) >= 0; }
257 template <
class Derived>
259 {
return lhs.
compare( rhs ) <= 0; }
261 template <
class Derived>
263 {
return lhs.
compare( rhs ) <= 0; }
265 template <
class Derived>
267 {
return lhs.
compare( rhs ) <= 0; }
269 template <
class Derived>
271 {
return lhs.
compare( rhs ) <= 0; }
273 template <
class Derived>
275 {
return rhs.
compare( lhs ) > 0; }
277 template <
class Derived>
279 {
return rhs.
compare( lhs ) > 0; }
281 template <
class Derived>
283 {
return rhs.
compare( lhs ) > 0; }
286 template <
class Derived>
288 {
return lhs.
compare( rhs ) > 0; }
290 template <
class Derived>
292 {
return lhs.
compare( rhs ) > 0; }
294 template <
class Derived>
296 {
return lhs.
compare( rhs ) > 0; }
298 template <
class Derived>
300 {
return lhs.
compare( rhs ) > 0; }
302 template <
class Derived>
304 {
return rhs.
compare( lhs ) <= 0; }
306 template <
class Derived>
308 {
return rhs.
compare( lhs ) <= 0; }
310 template <
class Derived>
312 {
return rhs.
compare( lhs ) <= 0; }
315 template <
class Derived>
317 {
return lhs.
compare( rhs ) >= 0; }
319 template <
class Derived>
321 {
return lhs.
compare( rhs ) >= 0; }
323 template <
class Derived>
325 {
return lhs.
compare( rhs ) >= 0; }
327 template <
class Derived>
329 {
return lhs.
compare( rhs ) >= 0; }
331 template <
class Derived>
333 {
return rhs.
compare( lhs ) < 0; }
335 template <
class Derived>
337 {
return rhs.
compare( lhs ) < 0; }
339 template <
class Derived>
341 {
return rhs.
compare( lhs ) < 0; }
Base class for creating IdString based types.
static int compare(const char *lhs, const std::string &rhs)
static int compare(const Derived &lhs, const IdString &rhs)
int compare(const std::string &rhs) const
const Derived & self() const
bool operator<=(const IdStringType< Derived > &lhs, const IdStringType< Derived > &rhs)
LessEqual.
int compare(const char *rhs) const
IdStringType(const IdStringType &)
static int compare(const std::string &lhs, const Derived &rhs)
bool operator<(const IdStringType< Derived > &lhs, const IdStringType< Derived > &rhs)
Less.
static int compare(const IdString &lhs, const IdString &rhs)
bool operator==(const IdStringType< Derived > &lhs, const IdStringType< Derived > &rhs)
Equal.
bool operator>=(const IdStringType< Derived > &lhs, const IdStringType< Derived > &rhs)
GreaterEqual.
static int compare(const char *lhs, const char *rhs)
static int _doCompare(const char *lhs, const char *rhs)
static int compare(const IdString &lhs, const std::string &rhs)
const char * c_str() const
static int compare(const char *lhs, const Derived &rhs)
void operator=(const IdStringType &)
int compare(const IdStringType &rhs) const
bool operator!=(const IdStringType< Derived > &lhs, const IdStringType< Derived > &rhs)
NotEqual.
static int compare(const Derived &lhs, const char *rhs)
static int compare(const std::string &lhs, const std::string &rhs)
static int compare(const std::string &lhs, const char *rhs)
static int compare(const char *lhs, const IdString &rhs)
bool operator>(const IdStringType< Derived > &lhs, const IdStringType< Derived > &rhs)
Greater.
static int compare(const std::string &lhs, const IdString &rhs)
std::ostream & operator<<(std::ostream &str, const IdStringType< Derived > &obj)
Stream output.
std::string asString() const
int compare(const Derived &rhs) const
static int compare(const IdString &lhs, const Derived &rhs)
static int compare(const Derived &lhs, const Derived &rhs)
int compare(const IdString &rhs) const
static int compare(const IdString &lhs, const char *rhs)
static int compare(const Derived &lhs, const std::string &rhs)
Access to the sat-pools string space.
unsigned size() const
The strings size.
const char * c_str() const
Conversion to const char *
sat::detail::IdType IdType
constexpr bool empty() const
Whether the string is empty.
IdType id() const
Expert backdoor.
std::string asString() const
Conversion to std::string
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.
bool operator<(const StrMatcher &lhs, const StrMatcher &rhs)
bool operator==(const SetRelation::Enum &lhs, const SetCompare &rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool operator>(const IdString &lhs, const char *rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool operator>=(const IdString &lhs, const char *rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool operator!=(const SetRelation::Enum &lhs, const SetCompare &rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool operator<=(const IdString &lhs, const char *rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Backlink to the associated PoolImpl.