summaryrefslogtreecommitdiffstats
path: root/example/asio-example.cpp
diff options
context:
space:
mode:
authorLei YU <mine260309@gmail.com>2019-01-04 14:35:14 +0800
committerLei YU <mine260309@gmail.com>2019-01-08 14:09:02 +0000
commit14269fbcc15fd0e764f672de144d44e8ee26dd78 (patch)
tree4c686233c4144d0a9a9b96540587667e03d3d65d /example/asio-example.cpp
parent42f6ad5b4724ecd3abd1ebb8a277610128e9fa7a (diff)
downloadsdbusplus-14269fbcc15fd0e764f672de144d44e8ee26dd78.tar.gz
sdbusplus-14269fbcc15fd0e764f672de144d44e8ee26dd78.zip
Fix incorrect defaultValue in generated server.hpp
In property.py, the defaultValue is got from yaml and it could be string, bool, or numeric. In case of bool, the value becomes True/False, and when it is rendered in C++ code, the code will not compile due to C++ expects true/false instead. And in server.hpp template, it checks "if p.defaultValue", and if the default value is "false" or 0, p.defaultValue becomes False, so the generated C++ code will not have default value. For example, a var defined in yaml has below default value: default: true default: false default: 0 will be rendered in C++ code as: var = True; var{}; var{}; This commit fixes the issue by converting defaultValue from True/False to true/false string, and check if by "if p.defaultValue is not None". Tested: Verify the above exmaple will generate valid C++ code as below: var = true; var = false; var = 0; Change-Id: I65c9f5222aa2d7b53299a53ff63d33bd6d073b95 Signed-off-by: Lei YU <mine260309@gmail.com>
Diffstat (limited to 'example/asio-example.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud