Add an overload to reuse the same characters for the two parameters of Target::stringInterpolation and use an escaped character sequence

This commit is contained in:
Username404 2021-09-11 13:41:57 +02:00
parent 26421597f2
commit e79a7415de
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
2 changed files with 2 additions and 1 deletions

View File

@ -19,6 +19,7 @@ protected:
std::stringstream output; std::stringstream output;
INCLUDECOMPONENT(StandardComponents::Define); INCLUDECOMPONENT(StandardComponents::Define);
INCLUDECOMPONENT(StandardComponents::types::String); INCLUDECOMPONENT(StandardComponents::types::String);
inline void stringInterpolation(const char* multiline, const string& view) { stringInterpolation(view, multiline, multiline); }
void stringInterpolation(string view, const char* openMultiline = "", const char* closeMultiline = "", const char* concatenationCharacters = "+") { void stringInterpolation(string view, const char* openMultiline = "", const char* closeMultiline = "", const char* concatenationCharacters = "+") {
vector<size_t> interpolationVector; vector<size_t> interpolationVector;
unsigned long occurrence_position = view.find(interpolationString); unsigned long occurrence_position = view.find(interpolationString);

View File

@ -7,7 +7,7 @@ struct PyTarget: Target {
output << parseComponent.name << " = "; output << parseComponent.name << " = ";
} }
void on(const StandardComponents::types::String &parseComponent) override { void on(const StandardComponents::types::String &parseComponent) override {
stringInterpolation(parseComponent.content, "\"\"\"", "\"\"\""); stringInterpolation(R"(""")", parseComponent.content);
} }
using Target::Target; using Target::Target;
}; };