MCPcopy Create free account
hub / github.com/build-cpp/cmkr / format

Function format

src/cmake_generator.cpp:45–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43};
44
45static std::string format(const char *format, const tsl::ordered_map<std::string, std::string> &variables) {
46 std::string s = format;
47 for (const auto &itr : variables) {
48 size_t start_pos = 0;
49 while ((start_pos = s.find(itr.first, start_pos)) != std::string::npos) {
50 s.replace(start_pos, itr.first.length(), itr.second);
51 start_pos += itr.second.length();
52 }
53 }
54 return s;
55}
56
57static std::string quoted(const std::string &str) {
58 return "\"" + str + "\"";

Callers 1

generate_projectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected