Debian Codegraph @

src/utils/replace_all.hpp

raw
1 #ifndef REPLACE_ALL
2 #define REPLACE_ALL
3
4 #include <string>
5 #include <regex>
6
7 #include "utils/string_view.hpp"
8
9 CPPTRACE_BEGIN_NAMESPACE
10 namespace detail {
11 // replace all instances of substr with the replacement
12 void replace_all(std::string& str, string_view substr, string_view replacement);
13
14 // replace all regex matches with the replacement
15 void replace_all(std::string& str, const std::regex& re, string_view replacement);
16
17 // replace all instances of substr with the replacement, including new instances introduced by the replacement
18 void replace_all_dynamic(std::string& str, string_view substr, string_view replacement);
19
20 // replace all matches of a regex including template parameters
21 void replace_all_template(std::string& str, const std::pair<std::regex, string_view>& rule);
22 }
23 CPPTRACE_END_NAMESPACE
24
25 #endif