28 const char * env = getenv(
"ZYPP_REPO_RELEASEVER");
29 return( env ? env :
"" );
43 typedef const std::string & (ReplacerData::*Getter)()
const;
45 const std::string & arch()
const
51 const std::string & basearch()
const
57 const std::string & releasever()
const
59 assertReleaseverStr();
63 const std::string & releaseverMajor()
const
65 assertReleaseverStr();
69 const std::string & releaseverMinor()
const
71 assertReleaseverStr();
76 void assertArchStr()
const
81 _arch = arch.asString();
85 void assertReleaseverStr()
const
97 if ( pos == std::string::npos )
122 std::string replacer( std::string value_r )
125 if ( ! value_r.empty() )
127 static const str::regex rxVAR(
"^([^$]*)\\$(\\{[[:alnum:]_]+\\}|[[:alnum:]_]+)([^$]*)" );
131 ReplacerData::Getter getter =
nullptr;
133 const char * varStart = value_r.c_str() + what.begin( 2 );
135 if ( *varStart ==
'{' )
143 #define ASSIGN_IF(NAME,GETTER) if ( ::strncmp( varStart, NAME, varSize ) == 0 ) getter = GETTER
145 case 4:
ASSIGN_IF(
"arch", &ReplacerData::arch );
break;
146 case 8:
ASSIGN_IF(
"basearch", &ReplacerData::basearch );
break;
147 case 10:
ASSIGN_IF(
"releasever", &ReplacerData::releasever );
break;
148 case 16:
ASSIGN_IF(
"releasever_major", &ReplacerData::releaseverMajor );
149 else ASSIGN_IF(
"releasever_minor", &ReplacerData::releaseverMinor );
break;
155 static const ReplacerData
_data;
156 if ( what.size( 1 ) > 0 ) ret += what[1];
157 ret += (_data.*getter)();
158 if ( what.size( 3 ) > 0 ) ret += what[3];
165 value_r.erase( 0, what.size( 0 ) );
166 if ( value_r.empty() )
169 if ( ! value_r.empty() )
170 ret += std::move(value_r);
179 return replacer( value );
std::string _releaseverMajor
std::string getPathData() const
Returns the encoded path component of the URL.
static ZConfig & instance()
Singleton ctor.
std::string distributionVersion() const
This is version attribute of the installed base product.
#define ASSIGN_IF(NAME, GETTER)
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
std::list< PublicKeyData > _data
std::string operator()(const std::string &value_r) const
void setPathData(const std::string &pathdata)
Set the path data component in the URL.
std::string _releaseverMinor
std::string getQueryString() const
Returns the encoded query string component of the URL.
void setQueryString(const std::string &querystr)
Set the query string in the URL.
bool regex_match(const std::string &s, smatch &matches, const regex ®ex)
regex ZYPP_STR_REGEX regex ZYPP_STR_REGEX
Url operator()(const Url &url_r) const
Easy-to use interface to the ZYPP dependency resolver.
std::string ZYPP_REPO_RELEASEVER()
Use faked releasever (e.g.