本文整理汇总了C++中boost::replace_all方法的典型用法代码示例。如果您正苦于以下问题:C++ boost::replace_all方法的具体用法?C++ boost::replace_all怎么用?C++ boost::replace_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost
的用法示例。
在下文中一共展示了boost::replace_all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getUpdateUrl
/**
* gets the url to the new version
*
* @return url to the new version
*/
String getUpdateUrl() {
using boost::replace_all;
String updateUrl;
try {
String facebookUpdatesUrl = kFacebookUpdatesUrl;
//get the prefix for debug mode from registry if any
String updateUrlPrefix = ToolbarSettings::getInstance().readStringValue(TO_UPDATEURLPREFIX);
if (!updateUrlPrefix.empty()) {
replace_all(facebookUpdatesUrl, _T("http://www"), updateUrlPrefix);
}
String version = getModuleVersion(NULL);
HttpUtils::doGetRequest(facebookUpdatesUrl + version, updateUrl);
}
catch(...) {
}
if (updateUrl.empty() ||
!isCorrectUrl(updateUrl)) {
// no service available or old version
updateUrl = String();
}
return updateUrl;
}
示例2: cName
std::string CommonMapping::cName(const NamePath& path) {
std::string fullName = path.str();
replace_all(fullName, ".", "_");
return fullName;
}
示例3: print_type_die
//.........这里部分代码省略.........
if (k.compare("(unknown attribute)") == 0) {
// FIXME FIXME FIXME
continue;
/* Leave unknown attributes as hex */
k = to_hex(pair.first);
} else {
k = k.substr(6, string::npos); // remove DW_AT_
}
const char *drop_attrs[] = {
"decl_file",
"decl_line",
"prototyped",
"external",
"sibling",
nullptr
};
for (unsigned int i = 0; drop_attrs[i] != nullptr; i++) {
if (k.compare(drop_attrs[i]) == 0) {
continue;
}
}
auto v = pair.second;
if (attrs_printed++ != 0) {
s << "," << endl;
}
s << k << " = ";
switch (v.get_form()) {
case attribute_value::STRING: {
string content = v.get_string();
replace_all(content, "\\", "\\\\");
replace_all(content, "\n", "\\n");
replace_all(content, "\"", "\\\"");
s << "\"" << content << "\"";
}
break;
case attribute_value::FLAG: {
if (v.get_flag()) {
s << "true";
} else {
s << "false";
}
}
break;
case attribute_value::UNSIGNED:
s << to_dec(v.get_unsigned()) << "u";
break;
case attribute_value::SIGNED:
s << to_dec(v.get_signed());
break;
case attribute_value::ADDR:
s << to_hex(v.get_address());
break;
case attribute_value::REF: {
auto ref = v.get_ref();
if (ref.abs) {
s << "@";
} else {
s << "+";
}
s << to_hex(ref.off);
}
break;