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>
173 inline std::ostream & operator<<( std::ostream & str, const IdStringType<Derived> & obj )
174 {
return str << obj.c_str(); }
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>
240 inline bool operator<( const IdStringType<Derived> & lhs,
const IdString & rhs )
241 {
return lhs.
compare( rhs ) < 0; }
243 template <
class Derived>
244 inline bool operator<( const IdStringType<Derived> & lhs,
const char * rhs )
245 {
return lhs.compare( rhs ) < 0; }
247 template <
class Derived>
248 inline bool operator<( const IdStringType<Derived> & lhs,
const std::string & rhs )
249 {
return lhs.compare( rhs ) < 0; }
251 template <
class Derived>
252 inline bool operator<( const IdString & lhs, const IdStringType<Derived> & rhs )
253 {
return rhs.compare( lhs ) >= 0; }
255 template <
class Derived>
256 inline bool operator<( const char * lhs, const IdStringType<Derived> & rhs )
257 {
return rhs.compare( lhs ) >= 0; }
259 template <
class Derived>
260 inline bool operator<( const std::string & lhs, const IdStringType<Derived> & rhs )
261 {
return rhs.compare( lhs ) >= 0; }
264 template <
class Derived>
266 {
return lhs.
compare( rhs ) <= 0; }
268 template <
class Derived>
269 inline bool operator<=( const IdStringType<Derived> & lhs,
const IdString & rhs )
270 {
return lhs.
compare( rhs ) <= 0; }
272 template <
class Derived>
273 inline bool operator<=( const IdStringType<Derived> & lhs,
const char * rhs )
274 {
return lhs.compare( rhs ) <= 0; }
276 template <
class Derived>
277 inline bool operator<=( const IdStringType<Derived> & lhs,
const std::string & rhs )
278 {
return lhs.compare( rhs ) <= 0; }
280 template <
class Derived>
281 inline bool operator<=( const IdString & lhs, const IdStringType<Derived> & rhs )
282 {
return rhs.compare( lhs ) > 0; }
284 template <
class Derived>
285 inline bool operator<=( const char * lhs, const IdStringType<Derived> & rhs )
286 {
return rhs.compare( lhs ) > 0; }
288 template <
class Derived>
289 inline bool operator<=( const std::string & lhs, const IdStringType<Derived> & rhs )
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; }
353 #endif // ZYPP_IDSTRINGTYPE_H static int compare(const std::string &lhs, const char *rhs)
int compare(const IdString &rhs) const
Compare IdString returning -1,0,1.
static int compare(const char *lhs, const char *rhs)
static int compare(const IdString &lhs, const std::string &rhs)
int compare(const IdStringType &rhs) const
IdType id() const
Expert backdoor.
String related utilities and Regular expression matching.
static int compare(const char *lhs, const std::string &rhs)
Access to the sat-pools string space.
bool operator==(const SetRelation::Enum &lhs, const SetCompare &rhs)
sat::detail::IdType IdType
Base class for creating IdString based types.
static int _doCompare(const char *lhs, const char *rhs) ZYPP_API
static int compare(const std::string &lhs, const IdString &rhs)
static int compare(const IdString &lhs, const char *rhs)
static int compare(const Derived &lhs, const Derived &rhs)
static int compare(const Derived &lhs, const IdString &rhs)
static int compare(const Derived &lhs, const char *rhs)
constexpr bool empty() const
Whether the string is empty.
Backlink to the associated PoolImpl.
std::string asString() const
static int compare(const std::string &lhs, const std::string &rhs)
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
bool operator>=(const IdStringType< Derived > &lhs, const IdStringType< Derived > &rhs)
static int compare(const char *lhs, const IdString &rhs)
static int compare(const Derived &lhs, const std::string &rhs)
bool operator>=(const IdString &lhs, const char *rhs)
unsigned size() const
The strings size.
const char * c_str() const
Conversion to const char *
bool operator>(const IdString &lhs, const char *rhs)
const Derived & self() const
bool operator!=(const SetRelation::Enum &lhs, const SetCompare &rhs)
bool operator==(const IdStringType< Derived > &lhs, const IdStringType< Derived > &rhs)
static int compare(const std::string &lhs, const Derived &rhs)
int compare(const Derived &rhs) const
bool operator>(const IdStringType< Derived > &lhs, const IdStringType< Derived > &rhs)
int compare(const IdString &rhs) const
static int compare(const IdString &lhs, const IdString &rhs)
static int compare(const char *lhs, const Derived &rhs)
std::string asString() const
Conversion to std::string
static int compare(const IdString &lhs, const Derived &rhs)
bool operator!=(const IdStringType< Derived > &lhs, const IdStringType< Derived > &rhs)
int compare(const char *rhs) const
Easy-to use interface to the ZYPP dependency resolver.
IdStringType & operator=(const IdStringType &)=default
const char * c_str() const
int compare(const std::string &rhs) const