Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix C++ to pass jsonization of concrete classes #444

Merged
merged 1 commit into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions aas_core_codegen/cpp/aas_common/_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,10 @@ def generate_implementation(library_namespace: Stripped) -> str:
{I}const char* utf8_text,
{I}size_t utf8_text_size
) {{
{I}if (utf8_text_size == 0) {{
{II}return std::wstring();
{I}}}

{I}#ifdef _WIN32
{I}// NOTE (mristin):
{I}// We have to use MultiByteToWideChar from <windows.h> on Windows
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<html>
<head>
<title>Replace curly brackets, backslashes and indent</title>
<script>
function processInput() {
var input = document.getElementById("input");
var output = document.getElementById("output");

var text = input.value
.replaceAll("{", "{{")
.replaceAll("}", "}}")
.replaceAll(/^ /gm, "{IIIII}")
.replaceAll(/^ /gm, "{IIII}")
.replaceAll(/^ /gm, "{III}")
.replaceAll(/^ /gm, "{II}")
.replaceAll(/^ /gm, "{I}")
.replaceAll("\\", "\\\\");

output.value = text;
}

function copyOutput() {
var output = document.getElementById("output");
output.select();
document.execCommand("copy");
}

window.onload = function() {
processInput();
}
</script>
</head>
<body>
<textarea id="input" cols="120" rows="10" oninput="processInput()"></textarea>
<br/><br/><br/>
<textarea id="output" cols="120" rows="10" readonly></textarea>
<br/><br/><br/>
<button onclick="copyOutput()">Copy</button>
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -13976,6 +13976,10 @@ std::wstring Utf8ToWstring(
const char* utf8_text,
size_t utf8_text_size
) {
if (utf8_text_size == 0) {
return std::wstring();
}

#ifdef _WIN32
// NOTE (mristin):
// We have to use MultiByteToWideChar from <windows.h> on Windows
Expand Down
Loading