Wrap boost::replace_all

This commit is contained in:
MacroFake
2022-05-05 08:28:29 +02:00
parent c367736f85
commit fa2deae2a8
8 changed files with 22 additions and 19 deletions

View File

@@ -3,3 +3,10 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <util/string.h>
#include <boost/algorithm/string/replace.hpp>
void ReplaceAll(std::string& in_out, std::string_view search, std::string_view substitute)
{
boost::replace_all(in_out, search, substitute);
}

View File

@@ -5,11 +5,11 @@
#ifndef BITCOIN_UTIL_STRING_H
#define BITCOIN_UTIL_STRING_H
#include <attributes.h>
#include <util/spanparsing.h>
#include <algorithm>
#include <array>
#include <cstdint>
#include <cstring>
#include <locale>
#include <sstream>
@@ -17,6 +17,8 @@
#include <string_view>
#include <vector>
void ReplaceAll(std::string& in_out, std::string_view search, std::string_view substitute);
[[nodiscard]] inline std::vector<std::string> SplitString(std::string_view str, char sep)
{
return spanparsing::Split<std::string>(str, sep);

View File

@@ -76,7 +76,6 @@
#include <malloc.h>
#endif
#include <boost/algorithm/string/replace.hpp>
#include <univalue.h>
#include <fstream>
@@ -1253,7 +1252,7 @@ fs::path GetSpecialFolderPath(int nFolder, bool fCreate)
std::string ShellEscape(const std::string& arg)
{
std::string escaped = arg;
boost::replace_all(escaped, "'", "'\"'\"'");
ReplaceAll(escaped, "'", "'\"'\"'");
return "'" + escaped + "'";
}
#endif