12#ifndef ZYPP_IDSTRINGTYPE_H
13#define ZYPP_IDSTRINGTYPE_H
85 template <
class Derived>
100 const Derived &
self()
const {
return *
static_cast<const Derived*
>( this ); }
110#ifdef __cpp_lib_string_view
111 std::string_view asStringView()
const {
return idStr().asStringView(); }
112 explicit operator std::string_view()
const {
return asStringView(); }
120 {
return !
empty(); }
127 explicit operator std::string()
const
134 static int compare(
const Derived & lhs,
const Derived & rhs ) {
return compare( lhs.idStr(), rhs.idStr() ); }
136 static int compare(
const Derived & lhs,
const std::string & rhs ) {
return compare( lhs.idStr(), rhs.c_str() ); }
137 static int compare(
const Derived & lhs,
const char * rhs ) {
return compare( lhs.idStr(), rhs );}
140 static int compare(
const IdString & lhs,
const IdString & rhs ) {
return lhs == rhs ? 0 : Derived::_doCompare( (lhs ? lhs.
c_str() : (
const char *)0 ),
141 (rhs ? rhs.
c_str() : (
const char *)0 ) ); }
143 static int compare(
const IdString & lhs,
const char * rhs ) {
return Derived::_doCompare( (lhs ? lhs.
c_str() : (
const char *)0 ), rhs ); }
145 static int compare(
const std::string & lhs,
const Derived & rhs ) {
return compare( lhs.c_str(), rhs.idStr() ); }
147 static int compare(
const std::string & lhs,
const std::string & rhs ) {
return compare( lhs.c_str(), rhs.c_str() ); }
148 static int compare(
const std::string & lhs,
const char * rhs ) {
return compare( lhs.c_str(), rhs ); }
150 static int compare(
const char * lhs,
const Derived & rhs ) {
return compare( lhs, rhs.idStr() ); }
151 static int compare(
const char * lhs,
const IdString & rhs ) {
return Derived::_doCompare( lhs, (rhs ? rhs.
c_str() : (
const char *)0 ) ); }
152 static int compare(
const char * lhs,
const std::string & rhs ) {
return compare( lhs, rhs.c_str() ); }
153 static int compare(
const char * lhs,
const char * rhs ) {
return Derived::_doCompare( lhs, rhs ); }
165 if ( ! lhs )
return rhs ? -1 : 0;
166 return rhs ? ::strcmp( lhs, rhs ) : 1;
172 template <
class Derived>
177 template <
class Derived>
179 {
return lhs.
compare( rhs ) == 0; }
181 template <
class Derived>
183 {
return lhs.
compare( rhs ) == 0; }
185 template <
class Derived>
187 {
return lhs.
compare( rhs ) == 0; }
189 template <
class Derived>
191 {
return lhs.
compare( rhs ) == 0; }
193 template <
class Derived>
195 {
return rhs.
compare( lhs ) == 0; }
197 template <
class Derived>
199 {
return rhs.
compare( lhs ) == 0; }
201 template <
class Derived>
203 {
return rhs.
compare( lhs ) == 0; }
206 template <
class Derived>
208 {
return lhs.
compare( rhs ) != 0; }
210 template <
class Derived>
212 {
return lhs.
compare( rhs ) != 0; }
214 template <
class Derived>
216 {
return lhs.
compare( rhs ) != 0; }
218 template <
class Derived>
220 {
return lhs.
compare( rhs ) != 0; }
222 template <
class Derived>
224 {
return rhs.
compare( lhs ) != 0; }
226 template <
class Derived>
228 {
return rhs.
compare( lhs ) != 0; }
230 template <
class Derived>
232 {
return rhs.
compare( lhs ) != 0; }
235 template <
class Derived>
237 {
return lhs.
compare( rhs ) < 0; }
239 template <
class Derived>
241 {
return lhs.
compare( rhs ) < 0; }
243 template <
class Derived>
245 {
return lhs.
compare( rhs ) < 0; }
247 template <
class Derived>
249 {
return lhs.
compare( rhs ) < 0; }
251 template <
class Derived>
253 {
return rhs.
compare( lhs ) >= 0; }
255 template <
class Derived>
257 {
return rhs.
compare( lhs ) >= 0; }
259 template <
class Derived>
261 {
return rhs.
compare( lhs ) >= 0; }
264 template <
class Derived>
266 {
return lhs.
compare( rhs ) <= 0; }
268 template <
class Derived>
270 {
return lhs.
compare( rhs ) <= 0; }
272 template <
class Derived>
274 {
return lhs.
compare( rhs ) <= 0; }
276 template <
class Derived>
278 {
return lhs.
compare( rhs ) <= 0; }
280 template <
class Derived>
282 {
return rhs.
compare( lhs ) > 0; }
284 template <
class Derived>
286 {
return rhs.
compare( lhs ) > 0; }
288 template <
class Derived>
290 {
return rhs.
compare( lhs ) > 0; }
293 template <
class Derived>
295 {
return lhs.
compare( rhs ) > 0; }
297 template <
class Derived>
299 {
return lhs.
compare( rhs ) > 0; }
301 template <
class Derived>
303 {
return lhs.
compare( rhs ) > 0; }
305 template <
class Derived>
307 {
return lhs.
compare( rhs ) > 0; }
309 template <
class Derived>
311 {
return rhs.
compare( lhs ) <= 0; }
313 template <
class Derived>
315 {
return rhs.
compare( lhs ) <= 0; }
317 template <
class Derived>
319 {
return rhs.
compare( lhs ) <= 0; }
322 template <
class Derived>
324 {
return lhs.
compare( rhs ) >= 0; }
326 template <
class Derived>
328 {
return lhs.
compare( rhs ) >= 0; }
330 template <
class Derived>
332 {
return lhs.
compare( rhs ) >= 0; }
334 template <
class Derived>
336 {
return lhs.
compare( rhs ) >= 0; }
338 template <
class Derived>
340 {
return rhs.
compare( lhs ) < 0; }
342 template <
class Derived>
344 {
return rhs.
compare( lhs ) < 0; }
346 template <
class Derived>
348 {
return rhs.
compare( lhs ) < 0; }
Base class for creating IdString based types.
IdStringType(IdStringType &&) noexcept=default
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
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.
IdStringType & operator=(const IdStringType &)=default
static int compare(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)
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)
static int _doCompare(const char *lhs, const char *rhs) ZYPP_API
bool operator>(const IdStringType< Derived > &lhs, const IdStringType< Derived > &rhs)
Greater.
IdStringType(const IdStringType &)=default
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...
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
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.