MCPcopy Create free account
hub / github.com/fmtlib/fmt / write_escaped_path

Function write_escaped_path

include/fmt/std.h:114–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112
113template <typename Char, typename PathChar>
114void write_escaped_path(basic_memory_buffer<Char>& quoted,
115 const std::filesystem::path& p,
116 const std::basic_string<PathChar>& native) {
117 if constexpr (std::is_same_v<Char, char> &&
118 std::is_same_v<PathChar, wchar_t>) {
119 auto buf = basic_memory_buffer<wchar_t>();
120 write_escaped_string<wchar_t>(std::back_inserter(buf), native);
121 bool valid = to_utf8<wchar_t>::convert(quoted, {buf.data(), buf.size()});
122 FMT_ASSERT(valid, "invalid utf16");
123 } else if constexpr (std::is_same_v<Char, PathChar>) {
124 write_escaped_string<std::filesystem::path::value_type>(
125 std::back_inserter(quoted), native);
126 } else {
127 write_escaped_string<Char>(std::back_inserter(quoted), p.string<Char>());
128 }
129}
130
131#endif // FMT_CPP_LIB_FILESYSTEM
132

Callers 1

formatMethod · 0.85

Calls 2

dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected