diff --git a/config_example.json b/config_example.json index 52f8ef2..dbb9a2a 100644 --- a/config_example.json +++ b/config_example.json @@ -6,7 +6,7 @@ "widgets": [ { - "name": "widget_name", + "type": "widget_type", "parameter1": "example", "parameter2": 10 } diff --git a/main.cpp b/main.cpp index e22b277..79d06b2 100644 --- a/main.cpp +++ b/main.cpp @@ -102,22 +102,22 @@ int main(int argc, char **argv) for (const json& j : widgets_cfg) { - string widget_name; - json_extract(j, "name", widget_name); - if (widget_name.empty()) + string widget_type; + json_extract(j, "type", widget_type); + if (widget_type.empty()) { continue; } - // Check if name exists in known builders - if (0 == widget_builders.count(widget_name)) + // Check if type exists in known builders + if (0 == widget_builders.count(widget_type)) { - cout << "Unknown widget '" << widget_name << "'. Skipping ..." << endl; + cout << "Unknown widget '" << widget_type << "'. Skipping ..." << endl; continue; } // Construct and add widget to vector - shared_ptr widget = widget_builders[widget_name](j); + shared_ptr widget = widget_builders[widget_type](j); if (nullptr != widget) { widgets.push_back(widget);