MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / _write_string_variant

Function _write_string_variant

compat/variant_writer_compat.cpp:1008–1024  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1006 }
1007
1008 static String _write_string_variant(const String &p_string) {
1009 if constexpr (is_script || is_v2_pcfg) { // v2 engine.cfg requires strings on a single line
1010 String escaped = p_string.replace("\\", "\\\\");
1011 escaped = escaped.replace("\a", "\\a");
1012 escaped = escaped.replace("\b", "\\b");
1013 escaped = escaped.replace("\f", "\\f");
1014 escaped = escaped.replace("\n", "\\n");
1015 escaped = escaped.replace("\r", "\\r");
1016 escaped = escaped.replace("\t", "\\t");
1017 escaped = escaped.replace("\v", "\\v");
1018 // escaped = escaped.replace("\'", "\\'");
1019 escaped = escaped.replace("\"", "\\\"");
1020 return "\"" + escaped + "\"";
1021 } else {
1022 return "\"" + p_string.c_escape_multiline() + "\"";
1023 }
1024 }
1025
1026 static String encode_resource_reference(const String &path) {
1027 if constexpr (after_4_4) {

Callers 2

write_compat_v4Method · 0.85
write_compat_v2_v3Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected