Skip to content

Commit

Permalink
fix(plugin): codegen binary, ref #149
Browse files Browse the repository at this point in the history
  • Loading branch information
iboB committed Nov 22, 2024
1 parent 87ed89d commit 9b20da9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions schema/code/generate-cpp-for-ac-model-schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def camel_case
def generate_read_from_val(pr)
if pr[:type] == :object
"#{pr[:cpp_val_type]}::fromDict(val)"
elsif pr[:type] == :binary
"std::move(val.get_binary())"
else
"std::move(val.get<#{pr[:cpp_val_type]}>())"
end
Expand All @@ -36,6 +38,12 @@ def generate_write(pr)
else
"#{pr[:cpp_name]}.toDict()"
end
elsif pr[:type] == :binary
if (pr[:opt])
"Dict::binary(std::move(*#{pr[:cpp_name]}))"
else
"Dict::binary(std::move(#{pr[:cpp_name]}))"
end
else
if (pr[:opt])
"std::move(*#{pr[:cpp_name]})"
Expand Down

0 comments on commit 9b20da9

Please sign in to comment.