本文整理汇总了C++中ReplaceAll函数的典型用法代码示例。如果您正苦于以下问题:C++ ReplaceAll函数的具体用法?C++ ReplaceAll怎么用?C++ ReplaceAll使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ReplaceAll函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load_ELF
/// Loads a CTR ELF file
bool Load_ELF(std::string &filename) {
std::string full_path = filename;
std::string path, file, extension;
SplitPath(ReplaceAll(full_path, "\\", "/"), &path, &file, &extension);
#if EMU_PLATFORM == PLATFORM_WINDOWS
path = ReplaceAll(path, "/", "\\");
#endif
File::IOFile f(filename, "rb");
if (f.IsOpen()) {
u64 size = f.GetSize();
u8* buffer = new u8[size];
ElfReader* elf_reader = NULL;
f.ReadBytes(buffer, size);
elf_reader = new ElfReader(buffer);
elf_reader->LoadInto(0x00100000);
Kernel::LoadExec(elf_reader->GetEntryPoint());
delete[] buffer;
delete elf_reader;
} else {
return false;
}
f.Close();
return true;
}
示例2: Load_PSP_ELF_PBP
bool Load_PSP_ELF_PBP(const char *filename, std::string *error_string)
{
// This is really just for headless, might need tweaking later.
if (!PSP_CoreParameter().mountIso.empty())
{
auto bd = constructBlockDevice(PSP_CoreParameter().mountIso.c_str());
if (bd != NULL) {
ISOFileSystem *umd2 = new ISOFileSystem(&pspFileSystem, bd);
pspFileSystem.Mount("umd1:", umd2);
pspFileSystem.Mount("disc0:", umd2);
pspFileSystem.Mount("umd:", umd2);
}
}
std::string full_path = filename;
std::string path, file, extension;
SplitPath(ReplaceAll(full_path, "\\", "/"), &path, &file, &extension);
#ifdef _WIN32
path = ReplaceAll(path, "/", "\\");
#endif
DirectoryFileSystem *fs = new DirectoryFileSystem(&pspFileSystem, path);
pspFileSystem.Mount("umd0:", fs);
std::string finalName = "umd0:/" + file + extension;
return __KernelLoadExec(finalName.c_str(), 0, error_string);
}
示例3: RemoveFilenameIllegalCharacters
void RemoveFilenameIllegalCharacters(GString &S, bool removeSlash)
{
// size_t len = strlen(fn);
ReplaceAll(S, "[<>:\\|?*]", "");
if (removeSlash)
ReplaceAll(S, "/", "");
}
示例4: EncodeJSONString
std::string EncodeJSONString(std::string &str)
{
ReplaceAll(str, "\n", "\\n");
ReplaceAll(str, "\r", "\\r");
ReplaceAll(str, "\"", "\\\"");
return str;
}
示例5: ReplaceAll
std::string ProxyData::AuthToString()
{
if(UserName.empty() || Password.empty())
return std::string();
return ReplaceAll(UserName,":","%3A") + ":" + ReplaceAll(Password,":","%3A");
}
示例6: RemoveFilenameIllegalCharacters
void RemoveFilenameIllegalCharacters(std::string &S, bool removeSlash, bool noAbsolute)
{
// size_t len = strlen(fn);
if (!noAbsolute)
ReplaceAll(S, "[<>\\|?*]", "");
else
ReplaceAll(S, "[<>\\|?*]", "");
if (removeSlash)
ReplaceAll(S, "/", "");
}
示例7: ReplaceAll
xml_node<TCHAR>* CXmlConfig::FindChild(const TCHAR* path){
_tstring allPath=path;
ReplaceAll(allPath,_T("/"),_T("\\"));
while(allPath.find(_T("\\\\"))!=_tstring::npos){
ReplaceAll(allPath,_T("\\\\"),_T("\\"));
}
xml_node<TCHAR>* node = m_xmlRoot->search_node(path);
return node;
}
示例8: Load_PSP_ELF_PBP
bool Load_PSP_ELF_PBP(const char *filename, std::string *error_string)
{
std::string full_path = filename;
std::string path, file, extension;
SplitPath(ReplaceAll(full_path, "\\", "/"), &path, &file, &extension);
#ifdef _WIN32
path = ReplaceAll(path, "/", "\\");
#endif
DirectoryFileSystem *fs = new DirectoryFileSystem(&pspFileSystem, path);
pspFileSystem.Mount("umd0:/", fs);
std::string finalName = "umd0:/" + file + extension;
return __KernelLoadExec(finalName.c_str(), 0, error_string);
}
示例9: WXUNUSED
void CGameListCtrl::OnWiki(wxCommandEvent& WXUNUSED (event))
{
const GameListItem *iso = GetSelectedISO();
if (!iso)
return;
std::string wikiUrl = "http://wiki.dolphin-emu.org/dolphin-redirect.php?gameid=[GAME_ID]";
wikiUrl = ReplaceAll(wikiUrl, "[GAME_ID]", UriEncode(iso->GetUniqueID()));
if (UriEncode(iso->GetName(0)).length() < 100)
wikiUrl = ReplaceAll(wikiUrl, "[GAME_NAME]", UriEncode(iso->GetName(0)));
else
wikiUrl = ReplaceAll(wikiUrl, "[GAME_NAME]", "");
WxUtils::Launch(wikiUrl.c_str());
}
示例10: ASSERT
LRESULT EditFind::FindReplaceCmd(WPARAM, LPARAM lParam)
{
FindReplaceDialog* dialog = FindReplaceDialog::GetNotifier(lParam);
ASSERT(dialog == m_dialog);
bool found = true;
if (dialog->IsTerminating())
{
m_lastFind = dialog->GetFindString();
m_searchDown = dialog->SearchDown();
m_matchCase = dialog->MatchCase();
m_matchWholeWord = dialog->MatchWholeWord();
m_dialog = NULL;
}
else if (dialog->FindNext())
{
found = FindNext(true);
if (!found)
found = FindNext(false);
}
else if (dialog->ReplaceCurrent())
found = Replace();
else if (dialog->ReplaceAll())
found = ReplaceAll();
if (!found)
::MessageBeep(MB_ICONEXCLAMATION);
return 0;
}
示例11: ReplaceAll
void
FindAndReplace::OnReplaceAll(LPFINDREPLACE& lpfr)
{
wyString findwhat;
wyString replacewith;
if(lpfr->lpstrFindWhat)
findwhat.SetAs(lpfr->lpstrFindWhat);
if(lpfr->lpstrReplaceWith)
replacewith.SetAs(lpfr->lpstrReplaceWith);
wyInt32 replacements = ReplaceAll(findwhat,
replacewith,
lpfr->Flags & FR_WHOLEWORD,
lpfr->Flags & FR_MATCHCASE);
if(replacements == -1)
return;
if(!replacements)
{
NotFoundMsg(lpfr->lpstrFindWhat);
}
else
{
wyString msg;
msg.Sprintf(_("Replaced %d instance(s)."), replacements);
ShowMessage(msg.GetAsWideChar(), MB_OK | MB_ICONINFORMATION);
}
return;
}
示例12: CreateTempDir
std::string CreateTempDir()
{
#ifdef _WIN32
TCHAR temp[MAX_PATH];
if (!GetTempPath(MAX_PATH, temp))
return "";
GUID guid;
CoCreateGuid(&guid);
TCHAR tguid[40];
StringFromGUID2(guid, tguid, 39);
tguid[39] = 0;
std::string dir = TStrToUTF8(temp) + "/" + TStrToUTF8(tguid);
if (!CreateDir(dir))
return "";
dir = ReplaceAll(dir, "\\", DIR_SEP);
return dir;
#else
const char* base = getenv("TMPDIR") ?: "/tmp";
std::string path = std::string(base) + "/DolphinWii.XXXXXX";
if (!mkdtemp(&path[0]))
return "";
return path;
#endif
}
示例13: function
std::string JavaScriptExtensions::GetUserAgentExtension(const std::string& UserAgent)
{
std::string rescode;
if(!UserAgent.empty())
{
rescode += std::string("Object.defineProperty(window.navigator, 'userAgent', {"
" get: function() {"
" return ") + picojson::value(UserAgent).serialize() + std::string(";"
" }"
"});");
rescode += std::string("Object.defineProperty(window.navigator, 'appVersion', {"
" get: function() {"
" return ") + picojson::value(ReplaceAll( UserAgent, "Mozilla/", "")).serialize() + std::string(";"
" }"
"});");
rescode += std::string("Object.defineProperty(window.navigator, 'vendor', {"
" get: function() {"
" return ") + picojson::value("").serialize() + std::string(";"
" }"
"});");
rescode += std::string("Object.defineProperty(window.navigator, 'platform', {"
" get: function() {"
" return ") + picojson::value("").serialize() + std::string(";"
" }"
"});");
}
return rescode;
}
示例14: ReplaceAll
BString&
BString::ReplaceAllChars(const char* replaceThis, const char* withThis,
int32 fromCharOffset)
{
return ReplaceAll(replaceThis, withThis,
UTF8CountBytes(fPrivateData, fromCharOffset));
}
示例15: GetTimeStamp
LRESULT CAgentCfg::WriteDevicesFile(std::string xmlFile, std::string destFolder)
{
std::string contents;
contents+="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
contents+="<MTConnectDevices xmlns=\"urn:mtconnect.org:MTConnectDevices:1.1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:mtconnect.org:MTConnectDevices:1.1 http://www.mtconnect.org/schemas/MTConnectDevices_1.1.xsd\">\n";
contents+=StdStringFormat("<Header bufferSize=\"130000\" instanceId=\"1\" creationTime=\"%s\" sender=\"local\" version=\"1.1\"/>\n",
GetTimeStamp().c_str());
contents+="<Devices>\n";
// Check all machine names unique
// Generate Devices.xml file with all devices in it.
for(UINT i=0; i<devices.size(); i++)
{
std::string config = ReadXmlDevicesFile(devices[i]);
ReplaceAll(config,"####", names[i]);
config=ReplaceOnce(config,"name=\"NNNNNN\"","name=\""+names[i]+"\"");
contents+=config+"\n";
}
contents+="</Devices>\n";
contents+="</MTConnectDevices>\n";
if(!xmlFile.empty())
WriteFile(destFolder + "\\" + xmlFile , contents);
return 0;
}