16#include <zypp/base/String.h>
19#include <zypp/sat/detail/PoolImpl.h>
29 inline std::string makeevrstr(
const std::string & version_r,
30 const std::string & release_r,
33 std::string ret( version_r );
34 if ( ! release_r.empty() )
43 inline std::string makeevrstr(
const char * version_r,
44 const char * release_r,
46 {
return makeevrstr( std::string(version_r?version_r:
""),
47 std::string(release_r?release_r:
""),
59 const std::string & release_r,
61 : _str( makeevrstr( version_r, release_r, epoch_r ) )
65 const char * release_r,
67 : _str( makeevrstr( version_r, release_r, epoch_r ) )
71 const std::string & release_r,
72 const std::string & epoch_r )
73 : _str( makeevrstr( version_r, release_r,
str::strtonum<
epoch_t>( epoch_r ) ) )
77 const char * release_r,
78 const char * epoch_r )
79 : _str( makeevrstr( version_r, release_r,
str::strtonum<
epoch_t>( epoch_r ) ) )
85 const char * sep =
str;
87 for ( ; *sep >=
'0' && *sep <=
'9'; ++sep )
90 return str::strtonum<epoch_t>( std::string(
str, sep-
str ) );
97 const char * sep =
str;
99 for ( ; *sep >=
'0' && *sep <=
'9'; ++sep )
104 sep = ::strrchr(
str,
'-' );
106 return std::string(
str, sep-
str );
113 const char * sep = ::strrchr(
str,
'-' );
117 return std::string();
122 if ( lhs == rhs )
return 0;
123 if ( lhs && rhs ) return ::pool_evrcmp_str(
myPool().getPool(), lhs, rhs, EVRCMP_COMPARE );
124 return( lhs ? 1 : -1 );
129 if ( lhs == rhs )
return 0;
130 if ( lhs && rhs ) return ::pool_evrcmp_str(
myPool().getPool(), lhs, rhs, EVRCMP_MATCH );
131 return( lhs ? 1 : -1 );
unsigned epoch_t
Type of an epoch.
std::string version() const
Version.
Edition()
Default ctor: noedition.
std::string release() const
Release.
static int _doMatch(const char *lhs, const char *rhs)
epoch_t epoch() const
Epoch.
static int _doCompare(const char *lhs, const char *rhs)
static const Edition noedition
Value representing noedition ("") This is in fact a valid Edition.
const char * c_str() const
String related utilities and Regular expression matching.
std::string numstring(char n, int w=0)
Easy-to use interface to the ZYPP dependency resolver.
static PoolImpl & myPool()