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 ); }
112 explicit operator bool()
const
113 {
return !
empty(); }
119 static int compare(
const Derived & lhs,
const Derived & rhs ) {
return compare( lhs.idStr(), rhs.idStr() ); }
121 static int compare(
const Derived & lhs,
const std::string & rhs ) {
return compare( lhs.idStr(), rhs.c_str() ); }
122 static int compare(
const Derived & lhs,
const char * rhs ) {
return compare( lhs.idStr(), rhs );}
125 static int compare(
const IdString & lhs,
const IdString & rhs ) {
return lhs == rhs ? 0 : Derived::_doCompare( (lhs ? lhs.
c_str() : (
const char *)0 ),
126 (rhs ? rhs.
c_str() : (
const char *)0 ) ); }
128 static int compare(
const IdString & lhs,
const char * rhs ) {
return Derived::_doCompare( (lhs ? lhs.
c_str() : (
const char *)0 ), rhs ); }
130 static int compare(
const std::string & lhs,
const Derived & rhs ) {
return compare( lhs.c_str(), rhs.idStr() ); }
132 static int compare(
const std::string & lhs,
const std::string & rhs ) {
return compare( lhs.c_str(), rhs.c_str() ); }
133 static int compare(
const std::string & lhs,
const char * rhs ) {
return compare( lhs.c_str(), rhs ); }
135 static int compare(
const char * lhs,
const Derived & rhs ) {
return compare( lhs, rhs.idStr() ); }
136 static int compare(
const char * lhs,
const IdString & rhs ) {
return Derived::_doCompare( lhs, (rhs ? rhs.
c_str() : (
const char *)0 ) ); }
137 static int compare(
const char * lhs,
const std::string & rhs ) {
return compare( lhs, rhs.c_str() ); }
138 static int compare(
const char * lhs,
const char * rhs ) {
return Derived::_doCompare( lhs, rhs ); }
150 if ( ! lhs )
return rhs ? -1 : 0;
151 return rhs ? ::strcmp( lhs, rhs ) : 1;
157 template <
class Derived>
158 inline std::ostream & operator<<( std::ostream & str, const IdStringType<Derived> & obj )
159 {
return str << obj.c_str(); }
162 template <
class Derived>
164 {
return lhs.
compare( rhs ) == 0; }
166 template <
class Derived>
168 {
return lhs.
compare( rhs ) == 0; }
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 rhs.
compare( lhs ) == 0; }
182 template <
class Derived>
184 {
return rhs.
compare( lhs ) == 0; }
186 template <
class Derived>
188 {
return rhs.
compare( lhs ) == 0; }
191 template <
class Derived>
193 {
return lhs.
compare( rhs ) != 0; }
195 template <
class Derived>
197 {
return lhs.
compare( rhs ) != 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 rhs.
compare( lhs ) != 0; }
211 template <
class Derived>
213 {
return rhs.
compare( lhs ) != 0; }
215 template <
class Derived>
217 {
return rhs.
compare( lhs ) != 0; }
220 template <
class Derived>
222 {
return lhs.
compare( rhs ) < 0; }
224 template <
class Derived>
225 inline bool operator<( const IdStringType<Derived> & lhs,
const IdString & rhs )
226 {
return lhs.
compare( rhs ) < 0; }
228 template <
class Derived>
229 inline bool operator<( const IdStringType<Derived> & lhs,
const char * rhs )
230 {
return lhs.compare( rhs ) < 0; }
232 template <
class Derived>
233 inline bool operator<( const IdStringType<Derived> & lhs,
const std::string & rhs )
234 {
return lhs.compare( rhs ) < 0; }
236 template <
class Derived>
237 inline bool operator<( const IdString & lhs, const IdStringType<Derived> & rhs )
238 {
return rhs.compare( lhs ) >= 0; }
240 template <
class Derived>
241 inline bool operator<( const char * lhs, const IdStringType<Derived> & rhs )
242 {
return rhs.compare( lhs ) >= 0; }
244 template <
class Derived>
245 inline bool operator<( const std::string & lhs, const IdStringType<Derived> & rhs )
246 {
return rhs.compare( lhs ) >= 0; }
249 template <
class Derived>
251 {
return lhs.
compare( rhs ) <= 0; }
253 template <
class Derived>
254 inline bool operator<=( const IdStringType<Derived> & lhs,
const IdString & rhs )
255 {
return lhs.
compare( rhs ) <= 0; }
257 template <
class Derived>
258 inline bool operator<=( const IdStringType<Derived> & lhs,
const char * rhs )
259 {
return lhs.compare( rhs ) <= 0; }
261 template <
class Derived>
262 inline bool operator<=( const IdStringType<Derived> & lhs,
const std::string & rhs )
263 {
return lhs.compare( rhs ) <= 0; }
265 template <
class Derived>
266 inline bool operator<=( const IdString & lhs, const IdStringType<Derived> & rhs )
267 {
return rhs.compare( lhs ) > 0; }
269 template <
class Derived>
270 inline bool operator<=( const char * lhs, const IdStringType<Derived> & rhs )
271 {
return rhs.compare( lhs ) > 0; }
273 template <
class Derived>
274 inline bool operator<=( const std::string & lhs, const IdStringType<Derived> & rhs )
275 {
return rhs.compare( lhs ) > 0; }
278 template <
class Derived>
280 {
return lhs.
compare( rhs ) > 0; }
282 template <
class Derived>
284 {
return lhs.
compare( rhs ) > 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 rhs.
compare( lhs ) <= 0; }
298 template <
class Derived>
300 {
return rhs.
compare( lhs ) <= 0; }
302 template <
class Derived>
304 {
return rhs.
compare( lhs ) <= 0; }
307 template <
class Derived>
309 {
return lhs.
compare( rhs ) >= 0; }
311 template <
class Derived>
313 {
return lhs.
compare( rhs ) >= 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 rhs.
compare( lhs ) < 0; }
327 template <
class Derived>
329 {
return rhs.
compare( lhs ) < 0; }
331 template <
class Derived>
333 {
return rhs.
compare( lhs ) < 0; }
338 #endif // ZYPP_IDSTRINGTYPE_H
static int compare(const std::string &lhs, const char *rhs)
void operator=(const IdStringType &)
bool operator!=(const CountryCode &lhs, const CountryCode &rhs)
IdType id() const
Expert backdoor.
static int compare(const char *lhs, const char *rhs)
static int compare(const IdString &lhs, const std::string &rhs)
static int compare(const char *lhs, const std::string &rhs)
Access to the sat-pools string space.
int compare(const Derived &rhs) const
Base class for creating IdString based types.
static int compare(const std::string &lhs, const IdString &rhs)
std::string asString() const
Conversion to std::string
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)
IdStringType(const IdStringType &)
Backlink to the associated PoolImpl.
int compare(const IdStringType &rhs) const
std::string asString() const
static int compare(const std::string &lhs, const std::string &rhs)
sat::detail::IdType IdType
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)
static int _doCompare(const char *lhs, const char *rhs)
const char * c_str() const
Conversion to const char *
int compare(const IdString &rhs) const
bool operator>(const IdString &lhs, const char *rhs)
bool operator==(const StrMatcher &lhs, const StrMatcher &rhs)
bool operator==(const IdStringType< Derived > &lhs, const IdStringType< Derived > &rhs)
const char * c_str() const
static int compare(const std::string &lhs, const Derived &rhs)
int compare(const IdString &rhs) const
Compare IdString returning -1,0,1.
bool operator>(const IdStringType< Derived > &lhs, const IdStringType< Derived > &rhs)
int compare(const std::string &rhs) const
int compare(const char *rhs) const
static int compare(const IdString &lhs, const IdString &rhs)
bool empty() const
Whether the string is empty.
static int compare(const char *lhs, const Derived &rhs)
unsigned size() const
The strings size.
static int compare(const IdString &lhs, const Derived &rhs)
bool operator!=(const IdStringType< Derived > &lhs, const IdStringType< Derived > &rhs)
const IdString & idStr() const