libzypp 9.41.1
|
String related utilities and Regular expressions. More...
Classes | |
class | regex |
class | smatch |
struct | SafeBuf |
Assert free called for allocated char * . More... | |
struct | Str |
Convenient building of std::string via std::ostream::operator<<. More... | |
Typedefs | |
typedef Exception | regex_error |
Functions | |
bool | regex_match (const char *s, str::smatch &matches, const regex ®ex) |
bool | regex_match (const std::string &s, str::smatch &matches, const regex ®ex) |
bool | regex_match (const char *s, const regex ®ex) |
bool | regex_match (const std::string &s, const regex ®ex) |
std::string | form (const char *format,...) __attribute__((format(printf |
Printf style construction of std::string. | |
std::string | strerror (int errno_r) |
Return string describing the error_r code. | |
std::string | stripFirstWord (std::string &line, const bool ltrim_first) |
std::string | stripLastWord (std::string &line, const bool rtrim_first) |
string | gsub (const string &sData, const string &sFrom, const string &sTo) |
string & | replaceAll (string &str, const string &from, const string &to) |
std::string | getline (std::istream &str, const Trim trim_r) |
Return stream content up to (but not returning) the next newline. | |
std::string | getline (std::istream &str, bool trim=false) |
Return stream content up to (but not returning) the next newline. | |
std::string | receiveUpTo (std::istream &str, const char delim_r, bool returnDelim_r=false) |
Return stream content up to the next ocurrence of delim_r or EOF delim_r , if found, is always read from the stream. | |
std::string | asString (const std::string &t) |
Global asString() that works with std::string too. | |
std::string | asString (const char *t) |
std::string | asString (char *t) |
template<class _T > | |
std::string | asString (const _T &t) |
template<class _T > | |
std::string | asString (const intrusive_ptr< _T > &p) |
template<class _T > | |
std::string | asString (const weak_ptr< _T > &p) |
template<> | |
std::string | asString (const bool &t) |
std::string | gsub (const std::string &sData, const std::string &sFrom, const std::string &sTo) |
Looks for text in a string and replaces it. | |
std::string & | replaceAll (std::string &str, const std::string &from, const std::string &to) |
Looks for text in string and replaces it in place. | |
bool | strToTrue (const C_Str &str) |
Parsing boolean from string. | |
bool | strToFalse (const C_Str &str) |
Return false if str is 0, false, no, off . | |
bool | strToBool (const C_Str &str, bool default_r) |
Parse str into a bool depending on the default value. | |
bool | strToBoolNodefault (const C_Str &str, bool &return_r) |
Parse str into a bool if it's a legal true or false string. | |
Hexencode. | |
Encode all characters other than [a-zA-Z0-9] as XX.
This includes the % character itself, which becomes 25. | |
std::string | hexencode (const C_Str &str_r) |
Encode all characters other than [a-zA-Z0-9] as XX. | |
std::string | hexdecode (const C_Str &str_r) |
Decode hexencoded XX sequences. | |
Case conversion. | |
std::string | toLower (const std::string &s) |
Return lowercase version of s. | |
std::string | toUpper (const std::string &s) |
Return uppercase version of s. | |
std::string | toLower (const char *s) |
std::string | toUpper (const char *s) |
Join. | |
std::string | escape (const C_Str &str_r, const char c= ' ') |
Escape desired character c using a backslash. | |
std::string | bEscape (const std::string &str_r, const C_Str &special_r) |
Return str_r with '\'-escaped chars occurring in special_r (and '\'). | |
std::string | rxEscapeStr (const std::string &str_r) |
Escape plain STRING str_r for use in a regex (not anchored by "^" or "$"). | |
std::string | rxEscapeGlob (const std::string &str_r) |
Escape GLOB str_r for use in a regex (not anchored by "^" or "$"). | |
template<class _Iterator > | |
std::string | join (_Iterator begin, _Iterator end, const C_Str &sep_r=" ") |
Join strings using separator sep_r (defaults to BLANK). | |
template<class _Container > | |
std::string | join (const _Container &cont_r, const C_Str &sep_r=" ") |
Join strings using separator sep_r (defaults to BLANK). | |
template<class _Iterator > | |
std::string | joinEscaped (_Iterator begin, _Iterator end, const char sep_r= ' ') |
Join strings using separator sep_r, quoting or escaping the values. | |
void | appendEscaped (std::string &str_r, const C_Str &next_r, const char sep_r= ' ') |
Escape next_r and append it to str_r using separator sep_r. | |
String representation of number. | |
std::string | numstring (char n, int w=0) |
std::string | numstring (unsigned char n, int w=0) |
std::string | numstring (short n, int w=0) |
std::string | numstring (unsigned short n, int w=0) |
std::string | numstring (int n, int w=0) |
std::string | numstring (unsigned n, int w=0) |
std::string | numstring (long n, int w=0) |
std::string | numstring (unsigned long n, int w=0) |
std::string | numstring (long long n, int w=0) |
std::string | numstring (unsigned long long n, int w=0) |
template<> | |
std::string | asString (const char &t) |
template<> | |
std::string | asString (const unsigned char &t) |
template<> | |
std::string | asString (const short &t) |
template<> | |
std::string | asString (const unsigned short &t) |
template<> | |
std::string | asString (const int &t) |
template<> | |
std::string | asString (const unsigned &t) |
template<> | |
std::string | asString (const long &t) |
template<> | |
std::string | asString (const unsigned long &t) |
template<> | |
std::string | asString (const long long &t) |
template<> | |
std::string | asString (const unsigned long long &t) |
String representation of number as hex value with leading '0x'. | |
Optional second argument sets the minimal string width (0 padded). Negative values will cause the number to be left adjusted within the string. Default width is 10 (4 for char). hexstring(42) -> "0x0000002a" hexstring(42, 4) -> "0x2a" hexstring(42,-4) -> "0x2a" | |
std::string | hexstring (char n, int w=4) |
std::string | hexstring (unsigned char n, int w=4) |
std::string | hexstring (short n, int w=10) |
std::string | hexstring (unsigned short n, int w=10) |
std::string | hexstring (int n, int w=10) |
std::string | hexstring (unsigned n, int w=10) |
std::string | hexstring (long n, int w=10) |
std::string | hexstring (unsigned long n, int w=10) |
std::string | hexstring (long long n, int w=0) |
std::string | hexstring (unsigned long long n, int w=0) |
String representation of number as octal value with leading '0'. | |
Optional second argument sets the minimal string width (0 padded). Negative values will cause the number to be left adjusted within the string. Default width is 5 (4 for char). octstring(42) -> "00052" octstring(42, 4) -> "0052" octstring(42,-4) -> "052 " | |
std::string | octstring (char n, int w=4) |
std::string | octstring (unsigned char n, int w=4) |
std::string | octstring (short n, int w=5) |
std::string | octstring (unsigned short n, int w=5) |
std::string | octstring (int n, int w=5) |
std::string | octstring (unsigned n, int w=5) |
std::string | octstring (long n, int w=5) |
std::string | octstring (unsigned long n, int w=5) |
std::string | octstring (long long n, int w=0) |
std::string | octstring (unsigned long long n, int w=0) |
template<typename _It > | |
_It | strtonum (const C_Str &str) |
Parsing numbers from string. | |
template<> | |
short | strtonum (const C_Str &str) |
Parsing numbers from string. | |
template<typename _It > | |
_It | strtonum (const C_Str &str, _It &i) |
String to integer type detemined 2nd function arg i. | |
Split. | |
template<class _OutputIterator > | |
unsigned | split (const C_Str &line_r, _OutputIterator result_r, const C_Str &sepchars_r=" \t") |
Split line_r into words. | |
template<class _OutputIterator > | |
unsigned | splitEscaped (const C_Str &line_r, _OutputIterator result_r, const C_Str &sepchars_r=" \t", bool withEmpty=false) |
Split line_r into words with respect to escape delimeters. | |
template<class _OutputIterator > | |
unsigned | splitFields (const C_Str &line_r, _OutputIterator result_r, const C_Str &sepchars_r=":") |
Split line_r into fields. | |
template<class _OutputIterator > | |
unsigned | splitFieldsEscaped (const C_Str &line_r, _OutputIterator result_r, const C_Str &sepchars_r=":") |
Split line_r into fields handling also escaped separators. | |
Case insensitive comparison. | |
int | compareCI (const C_Str &lhs, const C_Str &rhs) |
Locate substring. | |
bool | contains (const C_Str &str_r, const C_Str &val_r) |
Locate substring case sensitive. | |
bool | containsCI (const C_Str &str_r, const C_Str &val_r) |
Locate substring case insensitive. | |
String prefix/suffix handling. | |
bool | hasPrefix (const C_Str &str_r, const C_Str &prefix_r) |
Return whether str_r has prefix prefix_r. | |
std::string | stripPrefix (const C_Str &str_r, const C_Str &prefix_r) |
Strip a prefix_r from str_r and return the resulting string. | |
bool | hasSuffix (const C_Str &str_r, const C_Str &suffix_r) |
Return whether str_r has suffix suffix_r. | |
std::string | stripSuffix (const C_Str &str_r, const C_Str &suffix_r) |
Strip a suffix_r from str_r and return the resulting string. | |
bool | startsWith (const C_Str &str_r, const C_Str &prefix_r) |
alias for hasPrefix | |
bool | endsWith (const C_Str &str_r, const C_Str &prefix_r) |
alias for hasSuffix | |
Trimming whitepace. | |
| |
enum | Trim { NO_TRIM = 0x00, L_TRIM = 0x01, R_TRIM = 0x02, TRIM = (L_TRIM|R_TRIM) } |
To define how to trim. More... | |
std::string | trim (const std::string &s, const Trim trim_r) |
std::string | ltrim (const std::string &s) |
std::string | rtrim (const std::string &s) |
String related utilities and Regular expressions.
typedef Exception zypp::str::regex_error |
enum zypp::str::Trim |
bool zypp::str::regex_match | ( | const char * | s, |
str::smatch & | matches, | ||
const regex & | regex | ||
) |
Definition at line 59 of file Regex.cc.
References zypp::str::regex::m_preg, zypp::str::regex::m_valid, zypp::str::smatch::match_str, and zypp::str::smatch::pmatch.
Referenced by zypp::media::MediaAria2c::getFileCopy(), zypp::Capability::isInterestingFileSpec(), zypp::url::UrlBase::isValidHost(), zypp::url::UrlBase::isValidPort(), zypp::url::UrlBase::isValidScheme(), zypp::parser::ServiceFileReader::Impl::parseServices(), zypp::Url::parseUrl(), zypp::KeyRing::Impl::readSignatureKeyId(), regex_match(), zypp::repositories_in_dir(), zypp::parser::repositories_in_stream(), and zypp::MediaSetAccess::rewriteUrl().
bool zypp::str::regex_match | ( | const std::string & | s, |
str::smatch & | matches, | ||
const regex & | regex | ||
) | [inline] |
Definition at line 48 of file Regex.h.
References regex_match().
bool zypp::str::regex_match | ( | const char * | s, |
const regex & | regex | ||
) |
Definition at line 67 of file Regex.cc.
References zypp::str::regex::m_preg.
bool zypp::str::regex_match | ( | const std::string & | s, |
const regex & | regex | ||
) | [inline] |
Definition at line 52 of file Regex.h.
References regex_match().
std::string zypp::str::form | ( | const char * | format, |
... | |||
) |
Printf style construction of std::string.
Definition at line 34 of file String.cc.
References zypp::str::SafeBuf::_buf, and zypp::str::SafeBuf::asString().
Referenced by zypp::HistoryLogData::Impl::_checkFields(), zypp::RepoManager::addRepositories(), zypp::RepoManager::addRepository(), zypp::media::agentString(), zypp::media::MediaAria2c::agentString(), zypp::media::anonymousIdHeader(), zypp::sat::Solvable::asString(), zypp::PublicKeyData::asString(), zypp::media::MediaBlockList::asString(), zypp::exception_detail::CodeLocation::asString(), zypp::Errno::asString(), zypp::media::MediaCIFS::authenticate(), zypp::target::TargetImpl::buildCache(), zypp::RepoManager::buildCache(), zypp::CheckAccessDeleted::check(), zypp::ExternalProgram::checkStatus(), zypp::CheckSum::CheckSum(), zypp::filesystem::clean_dir(), zypp::RepoManager::cleanCacheDirGarbage(), zypp::parser::RepoindexFileReader::Impl::consumeNode(), zypp::Date::Date(), zypp::misc::defaultLoadSystem(), zypp::packagedelta::DeltaRpm::DeltaRpm(), zypp::media::distributionFlavorHeader(), zypp::target::CommitPackageCacheReadAhead::doCacheLastInteractive(), zypp::target::rpm::RpmDb::doInstallPackage(), zypp::target::rpm::RpmDb::doRebuildDatabase(), zypp::target::rpm::RpmDb::doRemovePackage(), zypp::media::MediaNoLoopDeviceException::dumpOn(), zypp::media::MediaBadCAException::dumpOn(), zypp::media::MediaTemporaryProblemException::dumpOn(), zypp::media::MediaTimeoutException::dumpOn(), zypp::media::MediaForbiddenException::dumpOn(), zypp::media::MediaNotEjectedException::dumpOn(), zypp::media::MediaIsSharedException::dumpOn(), zypp::media::MediaNotDesiredException::dumpOn(), zypp::media::MediaAria2cSetOptException::dumpOn(), zypp::media::MediaAria2cException::dumpOn(), zypp::media::MediaMetalinkSetOptException::dumpOn(), zypp::media::MediaMetalinkException::dumpOn(), zypp::media::MediaCurlSetOptException::dumpOn(), zypp::media::MediaCurlException::dumpOn(), zypp::media::MediaUnsupportedUrlSchemeException::dumpOn(), zypp::media::MediaNotADirException::dumpOn(), zypp::media::MediaNotAFileException::dumpOn(), zypp::media::MediaSystemException::dumpOn(), zypp::media::MediaAria2cInitException::dumpOn(), zypp::media::MediaMetalinkInitException::dumpOn(), zypp::media::MediaCurlInitException::dumpOn(), zypp::media::MediaWriteException::dumpOn(), zypp::media::MediaFileNotFoundException::dumpOn(), zypp::media::MediaNotOpenException::dumpOn(), zypp::media::MediaBadFilenameException::dumpOn(), zypp::media::MediaUnmountException::dumpOn(), zypp::media::MediaMountException::dumpOn(), zypp::parser::susetags::ContentFileReader::errPrefix(), zypp::PublicKeyData::expiresAsString(), zypp::repo::PackageProvider::failOnChecksumError(), zypp::media::fillAriaCmdLine(), zypp::Product::flavor(), zypp::base::ProfilingFormater::format(), zypp::base::LogControl::LineFormater::format(), zypp::media::MediaAria2c::getFileCopy(), zypp::InstanceId::getIdFor(), zypp::RepoInfo::getLicense(), zypp::ZYppFactory::getZYpp(), zypp::solver::detail::HelixControl::HelixControl(), hexstring(), zypp::HistoryLogData::Impl::Impl(), zypp::RepoManager::Impl::init_knownServices(), zypp::base::InterProcessMutex::InterProcessMutex(), zypp::repo::PluginServices::Impl::loadServices(), zypp::pool::ByIdent::makeIdent(), zypp::RepoManager::modifyRepository(), numstring(), octstring(), zypp::sat::detail::operator<<(), zypp::operator<<(), zypp::parser::operator<<(), zypp::Arch::CompatEntry::operator<<(), zypp::parser::IniParser::parse(), zypp::RepoManager::probe(), zypp::RepoManager::probeService(), zypp::solver::detail::SATResolver::problems(), zypp::solver::detail::ProblemSolutionIgnore::ProblemSolutionIgnore(), zypp::target::rpm::RpmDb::processConfigFiles(), zypp::repo::RepoMediaAccess::provideFile(), zypp::repo::PackageProvider::providePackage(), zypp::readPoolQueriesFromFile(), zypp::Product::referencePackage(), zypp::RepoManager::refreshMetadata(), zypp::RepoManager::refreshService(), zypp::RepoManager::removeRepository(), zypp::RepoManager::removeService(), zypp::ProgressData::report(), zypp::repositories_in_dir(), zypp::ResKind::satIdent(), zypp::solver::detail::SATResolver::SATprobleminfoString(), zypp::RepoManager::Impl::saveService(), zypp::url::UrlBase::setHost(), zypp::Repository::setInfo(), zypp::url::UrlBase::setPort(), zypp::url::UrlBase::setScheme(), zypp::xml::ParseDef::Impl::skipNode(), zypp::Package::sourcePkgLongName(), zypp::ExternalProgram::start_program(), strerror(), zypp::debug::Tm::timeStr(), zypp::writePoolQueriesToFile(), and zypp::target::writeUpgradeTestcase().
std::string std::string zypp::str::strerror | ( | int | errno_r | ) |
Return string describing the error_r code.
Like strerror, but the numerical value is included in the string as well.
Definition at line 51 of file String.cc.
References form().
Referenced by zypp::filesystem::__Log_Result(), zypp::Errno::asString(), zypp::ExternalProgram::close(), zypp::media::MediaCD::closeTray(), zypp::media::Mount::getEntries(), zypp::base::InterProcessMutex::InterProcessMutex(), zypp::media::MediaCD::openTray(), zypp::ExternalProgram::running(), zypp::externalprogram::ExternalDataSource::setBlocking(), zypp::ExternalProgram::start_program(), zypp::Exception::strErrno(), zypp::target::rpm::RpmDb::systemReadLine(), zypp::filesystem::TmpDir::TmpDir(), and zypp::filesystem::TmpFile::TmpFile().
bool zypp::str::strToTrue | ( | const C_Str & | str | ) |
Parsing boolean from string.
Return true
if str is 1, true, yes, on
(or a nonzero number).
Definition at line 61 of file String.cc.
References toLower().
Referenced by zypp::parser::RepoindexFileReader::Impl::consumeNode(), zypp::parser::ServiceFileReader::Impl::parseServices(), zypp::PoolQuery::recover(), zypp::parser::repositories_in_stream(), strToBool(), and strToBoolNodefault().
bool zypp::str::strToFalse | ( | const C_Str & | str | ) |
Return false
if str is 0, false, no, off
.
Definition at line 78 of file String.cc.
References toLower().
Referenced by zypp::PoolQuery::recover(), strToBool(), and strToBoolNodefault().
std::string zypp::str::hexencode | ( | const C_Str & | str_r | ) |
Encode all characters other than [a-zA-Z0-9] as XX.
This includes the % character itself, which becomes 25.
Definition at line 113 of file String.cc.
References zypp::C_Str::c_str(), and zypp::C_Str::size().
std::string zypp::str::hexdecode | ( | const C_Str & | str_r | ) |
Decode hexencoded XX sequences.
Definition at line 134 of file String.cc.
References zypp::C_Str::c_str(), for_, and zypp::C_Str::size().
Referenced by zypp::sat::detail::PoolImpl::nsCallback().
std::string zypp::str::toLower | ( | const std::string & | s | ) |
Return lowercase version of s.
Definition at line 166 of file String.cc.
Referenced by zypp::VendorAttr::_addVendorList(), zypp::CheckSum::CheckSum(), zypp::url::UrlBase::cleanupPathName(), zypp::solver::detail::HelixControl::deleteResolvable(), zypp::PublicKeyData::gpgPubkeyVersion(), zypp::solver::detail::helixXML(), zypp::solver::detail::HelixControl::installResolvable(), zypp::url::UrlBase::isKnownScheme(), zypp::url::UrlBase::isValidScheme(), zypp::solver::detail::HelixControl::keepResolvable(), zypp::solver::detail::HelixControl::lockResolvable(), zypp::url::UrlBase::setHost(), zypp::url::UrlBase::setPathName(), zypp::url::UrlBase::setScheme(), strToFalse(), strToTrue(), toLower(), and zypp::media::ProxyInfo::Impl::useProxyFor().
std::string zypp::str::toUpper | ( | const std::string & | s | ) |
Return uppercase version of s.
Definition at line 185 of file String.cc.
Referenced by zypp::url::UrlBase::setHost(), and toUpper().
std::string zypp::str::trim | ( | const std::string & | s, |
const Trim | trim_r | ||
) |
Definition at line 204 of file String.cc.
References L_TRIM, NO_TRIM, and R_TRIM.
Referenced by zypp::media::anonymousIdHeader(), zypp::HistoryLogData::create(), zypp::media::distributionFlavorHeader(), zypp::media::MediaAria2c::getAria2cVersion(), zypp::media::MediaAria2c::getFileCopy(), getline(), zypp::HistoryLogData::Impl::Impl(), zypp::target::SoftLocksFile::load(), zypp::target::RequestedLocalesFile::load(), zypp::SystemCheck::loadFile(), ltrim(), zypp::parser::IniParser::parse(), zypp::media::CurlConfig::parseConfig(), zypp::parser::HistoryLogReader::Impl::parseLine(), zypp::base::sysconfig::read(), zypp::PoolQuery::recover(), and rtrim().
std::string zypp::str::stripFirstWord | ( | std::string & | line, |
const bool | ltrim_first | ||
) |
Definition at line 237 of file String.cc.
References ltrim().
Referenced by zypp::parser::susetags::ContentFileReader::parse(), and zypp::scanProductsFile().
std::string zypp::str::stripLastWord | ( | std::string & | line, |
const bool | rtrim_first | ||
) |
string zypp::str::gsub | ( | const string & | sData, |
const string & | sFrom, | ||
const string & | sTo | ||
) |
Definition at line 298 of file String.cc.
Referenced by zypp::repo::RepoVariablesStringReplacer::operator()().
string& zypp::str::replaceAll | ( | string & | str, |
const string & | from, | ||
const string & | to | ||
) |
Definition at line 325 of file String.cc.
Referenced by zypp::RepoManager::Impl::generateFilename(), zypp::PoolQuery::recover(), zypp::PublicKeyScanner::Impl::scan(), zypp::PoolQuery::serialize(), and splitEscaped().
std::string zypp::str::escape | ( | const C_Str & | str_r, |
const char | c = ' ' |
||
) |
Escape desired character c using a backslash.
For use when printing c separated values, and where joinEscaped() is too heavy.
Definition at line 340 of file String.cc.
References zypp::C_Str::c_str(), for_, and zypp::C_Str::size().
Referenced by zypp::HistoryLog::addRepository(), appendEscaped(), zypp::RepoInfo::dumpAsXMLOn(), zypp::HistoryLog::install(), zypp::HistoryLog::modifyRepository(), zypp::HistoryLog::remove(), zypp::HistoryLog::removeRepository(), zypp::solver::detail::xml_escape(), and zypp::solver::detail::xml_tag_enclose().
std::string zypp::str::bEscape | ( | const std::string & | str_r, |
const C_Str & | special_r | ||
) |
Return str_r with '\'-escaped chars occurring in special_r (and '\').
Definition at line 363 of file String.cc.
References zypp::C_Str::c_str(), and for_.
Referenced by rxEscapeStr().
std::string zypp::str::rxEscapeStr | ( | const std::string & | str_r | ) |
Escape plain STRING str_r for use in a regex (not anchored by "^" or "$").
Definition at line 384 of file String.cc.
References bEscape(), and RXSPECIALCHARS.
std::string zypp::str::rxEscapeGlob | ( | const std::string & | str_r | ) |
Escape GLOB str_r for use in a regex (not anchored by "^" or "$").
Definition at line 389 of file String.cc.
References for_, and RXSPECIALCHARS.
std::string zypp::str::getline | ( | std::istream & | str, |
const Trim | trim_r | ||
) |
Return stream content up to (but not returning) the next newline.
Definition at line 447 of file String.cc.
References receiveUpTo(), and trim().
Referenced by zypp::scanProductsFile().
std::string zypp::str::getline | ( | std::istream & | str, |
bool | trim = false |
||
) |
Return stream content up to (but not returning) the next newline.
Definition at line 452 of file String.cc.
References NO_TRIM, receiveUpTo(), TRIM, and trim().
std::string zypp::str::receiveUpTo | ( | std::istream & | str, |
const char | delim_r, | ||
bool | returnDelim_r = false |
||
) |
Return stream content up to the next ocurrence of delim_r
or EOF delim_r
, if found, is always read from the stream.
Whether it is also returned in the string depends on returnDelim_r
. If the stream status is good
, delim_r
was found in the stream. If we reached EOF while looking for delim_r
, eof
is set; and also fail
, if we did not read any data before.
Definition at line 457 of file String.cc.
Referenced by getline(), and zypp::PluginFrame::Impl::Impl().
std::string zypp::str::asString | ( | const std::string & | t | ) | [inline] |
Global asString() that works with std::string too.
Definition at line 130 of file String.h.
Referenced by zypp::CapDetail::_init(), zypp::media::MediaNFS::attachTo(), zypp::media::MediaISO::attachTo(), zypp::media::MediaDISK::attachTo(), zypp::media::MediaDIR::attachTo(), zypp::media::MediaCIFS::attachTo(), zypp::media::MediaCD::attachTo(), zypp::target::rpm::librpmDb::D::D(), zypp::repo::susetags::Downloader::download(), zypp::RepoInfo::dumpAsIniOn(), zypp::RepoInfo::dumpAsXMLOn(), zypp::RepoInfo::dumpOn(), zypp::media::MediaHandler::getDirectoryYast(), join(), joinEscaped(), zypp::sat::LookupAttr::iterator::asType< std::string >(), zypp::media::MediaDISK::MediaDISK(), zypp::sat::detail::PoolImpl::nsCallback(), zypp::Fetcher::Impl::readContentFileIndex(), zypp::media::MediaNFS::releaseFrom(), zypp::media::MediaISO::releaseFrom(), zypp::media::MediaDISK::releaseFrom(), zypp::media::MediaCIFS::releaseFrom(), and zypp::sat::LookupAttr::iterator::subFind().
std::string zypp::str::asString | ( | const _T & | t | ) | [inline] |
std::string zypp::str::asString | ( | const intrusive_ptr< _T > & | p | ) | [inline] |
std::string zypp::str::asString | ( | const weak_ptr< _T > & | p | ) | [inline] |
std::string zypp::str::asString | ( | const bool & | t | ) | [inline] |
std::string zypp::str::numstring | ( | char | n, |
int | w = 0 |
||
) | [inline] |
Definition at line 224 of file String.h.
References form().
Referenced by zypp::sat::LookupAttr::iterator::asString(), zypp::media::MediaSource::asString(), asString(), zypp::zypp_detail::ZYppImpl::commit(), zypp::solver::detail::Testcase::createTestcase(), zypp::parser::plaindir::dirStatus(), zypp::media::MediaMultiCurl::doGetFileCopy(), zypp::media::MediaCurl::doGetFileCopy(), zypp::ServiceInfo::dumpAsIniOn(), zypp::debug::dumpMemOn(), zypp::media::MediaCurl::evaluateCurlCode(), zypp::media::MediaManager_Impl::findMM(), zypp::CheckAccessDeleted::findService(), zypp::RepoManager::Impl::generateNonExistingName(), zypp::ZYppFactory::getZYpp(), zypp::solver::detail::HelixControl::HelixControl(), zypp::solver::detail::helixXML(), zypp::repo::SUSEMediaVerifier::isDesiredMedia(), zypp::ZYppGlobalLock::isProcessRunning(), zypp::base::InterProcessMutex::isProcessRunning(), zypp::Arch::CompatEntry::operator<<(), zypp::RepoStatus::RepoStatus(), zypp::MediaSetAccess::rewriteUrl(), and zypp::syscontent::Writer::Impl::writeXml().
std::string zypp::str::numstring | ( | unsigned char | n, |
int | w = 0 |
||
) | [inline] |
std::string zypp::str::numstring | ( | short | n, |
int | w = 0 |
||
) | [inline] |
std::string zypp::str::numstring | ( | unsigned short | n, |
int | w = 0 |
||
) | [inline] |
std::string zypp::str::numstring | ( | int | n, |
int | w = 0 |
||
) | [inline] |
std::string zypp::str::numstring | ( | unsigned | n, |
int | w = 0 |
||
) | [inline] |
std::string zypp::str::numstring | ( | long | n, |
int | w = 0 |
||
) | [inline] |
std::string zypp::str::numstring | ( | unsigned long | n, |
int | w = 0 |
||
) | [inline] |
std::string zypp::str::numstring | ( | long long | n, |
int | w = 0 |
||
) | [inline] |
std::string zypp::str::numstring | ( | unsigned long long | n, |
int | w = 0 |
||
) | [inline] |
std::string zypp::str::asString | ( | const char & | t | ) | [inline] |
Definition at line 235 of file String.h.
References numstring().
std::string zypp::str::asString | ( | const unsigned char & | t | ) | [inline] |
Definition at line 236 of file String.h.
References numstring().
std::string zypp::str::asString | ( | const short & | t | ) | [inline] |
Definition at line 237 of file String.h.
References numstring().
std::string zypp::str::asString | ( | const unsigned short & | t | ) | [inline] |
Definition at line 238 of file String.h.
References numstring().
std::string zypp::str::asString | ( | const int & | t | ) | [inline] |
Definition at line 239 of file String.h.
References numstring().
std::string zypp::str::asString | ( | const unsigned & | t | ) | [inline] |
Definition at line 240 of file String.h.
References numstring().
std::string zypp::str::asString | ( | const long & | t | ) | [inline] |
Definition at line 241 of file String.h.
References numstring().
std::string zypp::str::asString | ( | const unsigned long & | t | ) | [inline] |
Definition at line 242 of file String.h.
References numstring().
std::string zypp::str::asString | ( | const long long & | t | ) | [inline] |
Definition at line 243 of file String.h.
References numstring().
std::string zypp::str::asString | ( | const unsigned long long & | t | ) | [inline] |
Definition at line 244 of file String.h.
References numstring().
std::string zypp::str::hexstring | ( | char | n, |
int | w = 4 |
||
) | [inline] |
Definition at line 259 of file String.h.
References form().
Referenced by zypp::PublicKeyData::gpgPubkeyRelease(), zypp::RepoManager::makeStupidAlias(), zypp::operator<<(), and zypp::base::operator<<().
std::string zypp::str::hexstring | ( | unsigned char | n, |
int | w = 4 |
||
) | [inline] |
std::string zypp::str::hexstring | ( | short | n, |
int | w = 10 |
||
) | [inline] |
std::string zypp::str::hexstring | ( | unsigned short | n, |
int | w = 10 |
||
) | [inline] |
std::string zypp::str::hexstring | ( | int | n, |
int | w = 10 |
||
) | [inline] |
std::string zypp::str::hexstring | ( | unsigned | n, |
int | w = 10 |
||
) | [inline] |
std::string zypp::str::hexstring | ( | long | n, |
int | w = 10 |
||
) | [inline] |
std::string zypp::str::hexstring | ( | unsigned long | n, |
int | w = 10 |
||
) | [inline] |
std::string zypp::str::hexstring | ( | long long | n, |
int | w = 0 |
||
) | [inline] |
std::string zypp::str::hexstring | ( | unsigned long long | n, |
int | w = 0 |
||
) | [inline] |
std::string zypp::str::octstring | ( | char | n, |
int | w = 4 |
||
) | [inline] |
Definition at line 283 of file String.h.
References form().
Referenced by zypp::filesystem::assert_dir(), zypp::filesystem::assert_file(), zypp::filesystem::chmod(), and zypp::filesystem::mkdir().
std::string zypp::str::octstring | ( | unsigned char | n, |
int | w = 4 |
||
) | [inline] |
std::string zypp::str::octstring | ( | short | n, |
int | w = 5 |
||
) | [inline] |
std::string zypp::str::octstring | ( | unsigned short | n, |
int | w = 5 |
||
) | [inline] |
std::string zypp::str::octstring | ( | int | n, |
int | w = 5 |
||
) | [inline] |
std::string zypp::str::octstring | ( | unsigned | n, |
int | w = 5 |
||
) | [inline] |
std::string zypp::str::octstring | ( | long | n, |
int | w = 5 |
||
) | [inline] |
std::string zypp::str::octstring | ( | unsigned long | n, |
int | w = 5 |
||
) | [inline] |
std::string zypp::str::octstring | ( | long long | n, |
int | w = 0 |
||
) | [inline] |
std::string zypp::str::octstring | ( | unsigned long long | n, |
int | w = 0 |
||
) | [inline] |
_It zypp::str::strtonum | ( | const C_Str & | str | ) | [inline] |
Parsing numbers from string.
String to integer type determined by template arg.
time_t t = strtonum<time_t>( "42" );
Definition at line 309 of file String.h.
Referenced by zypp::CheckAccessDeleted::check(), zypp::PluginScript::Impl::close(), zypp::Date::Date(), zypp::ZConfig::Impl::Impl(), and zypp::parser::ServiceFileReader::Impl::parseServices().
unsigned long long zypp::str::strtonum | ( | const C_Str & | str | ) | [inline] |
Parsing numbers from string.
String to integer type determined by template arg.
time_t t = strtonum<time_t>( "42" );
Definition at line 309 of file String.h.
Referenced by zypp::CheckAccessDeleted::check(), zypp::PluginScript::Impl::close(), zypp::Date::Date(), zypp::ZConfig::Impl::Impl(), and zypp::parser::ServiceFileReader::Impl::parseServices().
_It zypp::str::strtonum | ( | const C_Str & | str, |
_It & | i | ||
) | [inline] |
bool zypp::str::strToBool | ( | const C_Str & | str, |
bool | default_r | ||
) | [inline] |
Parse str
into a bool depending on the default value.
If the default
is true, look for a legal false
string. If the default
is false, look for a legal true
string.
Definition at line 350 of file String.h.
References strToFalse(), and strToTrue().
Referenced by zypp::ZConfig::Impl::Impl(), zypp::parser::ServiceFileReader::Impl::parseServices(), and zypp::media::MediaCurl::setupEasy().
bool zypp::str::strToBoolNodefault | ( | const C_Str & | str, |
bool & | return_r | ||
) | [inline] |
Parse str
into a bool if it's a legal true
or false
string.
If str
is not a recognized true
or false
string, return_r is left unchanged.
Definition at line 357 of file String.h.
References strToFalse(), and strToTrue().
std::string zypp::str::gsub | ( | const std::string & | sData, |
const std::string & | sFrom, | ||
const std::string & | sTo | ||
) |
Looks for text in a string and replaces it.
std::string& zypp::str::replaceAll | ( | std::string & | str, |
const std::string & | from, | ||
const std::string & | to | ||
) |
Looks for text in string and replaces it in place.
unsigned zypp::str::split | ( | const C_Str & | line_r, |
_OutputIterator | result_r, | ||
const C_Str & | sepchars_r = " \t" |
||
) |
Split line_r into words.
Any sequence of characters in sepchars_r is treated as delimiter. The words are passed to OutputIterator result_r.
std::vector<std::string> words; str::split( "some line", std::back_inserter(words) )
Definition at line 395 of file String.h.
Referenced by zypp::VendorAttr::addVendorFile(), zypp::media::MediaNFS::attachTo(), zypp::media::CurlAuthData::auth_type_str2long(), zypp::Package::authors(), zypp::DiskUsageCounter::detectMountPoints(), zypp::repo::susetags::Downloader::download(), zypp::media::fillAriaCmdLine(), zypp::media::fillSettingsFromUrl(), zypp::ZConfig::Impl::Impl(), zypp::SystemCheck::loadFile(), zypp::media::MediaCD::MediaCD(), zypp::media::ProxyInfoSysconfig::ProxyInfoSysconfig(), zypp::Fetcher::Impl::readSha1sumsIndex(), zypp::parser::repositories_in_stream(), zypp::sat::detail::PoolImpl::requiredFilesystems(), and zypp::parser::susetags::ContentFileReader::Impl::setFileCheckSum().
unsigned zypp::str::splitEscaped | ( | const C_Str & | line_r, |
_OutputIterator | result_r, | ||
const C_Str & | sepchars_r = " \t" , |
||
bool | withEmpty = false |
||
) |
Split line_r into words with respect to escape delimeters.
Any sequence of characters in sepchars_r is treated as delimiter if not inside "" or "" or escaped by \, but not \. The words are passed to OutputIterator result_r.
std::vector<std::string> words; str::splitEscaped( "some line", std::back_inserter(words) )
example splitted strings normal line -> 2 elements ( "normal", "line" ) escaped\ line -> 1 element( "escaped line" ) "quoted line" -> 1 element same as above 'quoted line' -> 1 element same as above "escaped quote\'" -> 1 element ( "escaped quote'" ) \param line_r The string to parse. \param result_r \param sepchars_r String of separator characters. \param withEmpty Whether to include empty fields between separators in the result.
Definition at line 447 of file String.h.
References replaceAll().
Referenced by zypp::parser::HistoryLogReader::Impl::parseLine(), zypp::parser::ServiceFileReader::Impl::parseServices(), and splitFieldsEscaped().
unsigned zypp::str::splitFields | ( | const C_Str & | line_r, |
_OutputIterator | result_r, | ||
const C_Str & | sepchars_r = ":" |
||
) |
Split line_r into fields.
Any single character in sepchars_r is treated as a field separator. The words are passed to OutputIterator result_r.
"" -> words 0 ":" -> words 2 ||| "a" -> words 1 |a| ":a" -> words 2 ||a| "a:" -> words 2 |a|| ":a:" -> words 3 ||a||
std::vector<std::string> words; str::split( "some line", std::back_inserter(words) )
Definition at line 584 of file String.h.
Referenced by zypp::PublicKeyScanner::Impl::scan().
unsigned zypp::str::splitFieldsEscaped | ( | const C_Str & | line_r, |
_OutputIterator | result_r, | ||
const C_Str & | sepchars_r = ":" |
||
) |
Split line_r into fields handling also escaped separators.
Definition at line 621 of file String.h.
References splitEscaped().
std::string zypp::str::join | ( | _Iterator | begin, |
_Iterator | end, | ||
const C_Str & | sep_r = " " |
||
) |
Join strings using separator sep_r (defaults to BLANK).
Definition at line 636 of file String.h.
References asString().
Referenced by zypp::Arch::asString(), zypp::media::MediaNFS::attachTo(), zypp::media::CurlAuthData::auth_type_long2str(), and join().
std::string zypp::str::join | ( | const _Container & | cont_r, |
const C_Str & | sep_r = " " |
||
) |
std::string zypp::str::joinEscaped | ( | _Iterator | begin, |
_Iterator | end, | ||
const char | sep_r = ' ' |
||
) |
Join strings using separator sep_r, quoting or escaping the values.
Separator defaults to BLANK. Use splitEscaped to restore the values.
Definition at line 660 of file String.h.
References asString(), and for_.
Referenced by zypp::ServiceInfo::dumpAsIniOn(), and zypp::operator<<().
void zypp::str::appendEscaped | ( | std::string & | str_r, |
const C_Str & | next_r, | ||
const char | sep_r = ' ' |
||
) | [inline] |
Escape next_r and append it to str_r using separator sep_r.
Definition at line 714 of file String.h.
References zypp::C_Str::empty(), and escape().
std::string zypp::str::toLower | ( | const char * | s | ) | [inline] |
std::string zypp::str::toUpper | ( | const char * | s | ) | [inline] |
int zypp::str::compareCI | ( | const C_Str & | lhs, |
const C_Str & | rhs | ||
) | [inline] |
Definition at line 774 of file String.h.
Referenced by zypp::Patch::categoryEnum(), and zypp::ZConfig::Impl::Impl().
bool zypp::str::contains | ( | const C_Str & | str_r, |
const C_Str & | val_r | ||
) | [inline] |
bool zypp::str::containsCI | ( | const C_Str & | str_r, |
const C_Str & | val_r | ||
) | [inline] |
std::string zypp::str::ltrim | ( | const std::string & | s | ) | [inline] |
Definition at line 803 of file String.h.
References L_TRIM, and trim().
Referenced by zypp::parser::IniParser::parse(), and stripFirstWord().
std::string zypp::str::rtrim | ( | const std::string & | s | ) | [inline] |
Definition at line 806 of file String.h.
References R_TRIM, and trim().
Referenced by zypp::parser::IniParser::parse(), and stripLastWord().
bool zypp::str::hasPrefix | ( | const C_Str & | str_r, |
const C_Str & | prefix_r | ||
) | [inline] |
Return whether str_r has prefix prefix_r.
Definition at line 839 of file String.h.
References zypp::C_Str::size().
Referenced by zypp::Fetcher::Impl::addDirJobs(), zypp::filesystem::Pathname::assertprefix(), zypp::media::MediaHandler::checkAttached(), zypp::media::MediaHandler::createAttachPoint(), zypp::repo::susetags::Downloader::download(), zypp::InstanceId::findPoolItem(), zypp::Product::flavor(), zypp::media::MediaHandler::forceRelaseAllMedia(), zypp::media::MediaAria2c::getFileCopy(), zypp::RepoInfo::getLicenseLocales(), zypp::sat::detail::PoolImpl::multiversionListInit(), zypp::sat::Solvable::providesNamespace(), startsWith(), stripPrefix(), and zypp::sat::Solvable::valuesOfNamespace().
std::string zypp::str::stripPrefix | ( | const C_Str & | str_r, |
const C_Str & | prefix_r | ||
) | [inline] |
Strip a prefix_r from str_r and return the resulting string.
Definition at line 843 of file String.h.
References zypp::C_Str::c_str(), hasPrefix(), and zypp::C_Str::size().
Referenced by zypp::repo::susetags::Downloader::download(), and zypp::Product::flavor().
bool zypp::str::hasSuffix | ( | const C_Str & | str_r, |
const C_Str & | suffix_r | ||
) | [inline] |
Return whether str_r has suffix suffix_r.
Definition at line 847 of file String.h.
References zypp::C_Str::size().
Referenced by endsWith(), zypp::RepoInfo::getLicenseLocales(), zypp::InstanceId::isSystemId(), stripSuffix(), and zypp::media::ProxyInfo::Impl::useProxyFor().
std::string zypp::str::stripSuffix | ( | const C_Str & | str_r, |
const C_Str & | suffix_r | ||
) | [inline] |
Strip a suffix_r from str_r and return the resulting string.
Definition at line 851 of file String.h.
References zypp::C_Str::c_str(), hasSuffix(), and zypp::C_Str::size().
bool zypp::str::startsWith | ( | const C_Str & | str_r, |
const C_Str & | prefix_r | ||
) | [inline] |
alias for hasPrefix
Definition at line 859 of file String.h.
References hasPrefix().
Referenced by zypp::target::rpm::RpmDb::importPubkey(), zypp::parser::ServiceFileReader::Impl::parseServices(), and zypp::target::writeUpgradeTestcase().
bool zypp::str::endsWith | ( | const C_Str & | str_r, |
const C_Str & | prefix_r | ||
) | [inline] |
alias for hasSuffix
Definition at line 862 of file String.h.
References hasSuffix().
Referenced by zypp::repo::susetags::Downloader::download().