MCPcopy Create free account
hub / github.com/LunarG/VulkanTools / Triggered

Method Triggered

vkconfig_core/message.cpp:35–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35bool Message::Triggered(const SettingDataSet& data_set) const {
36 bool result = true;
37
38 for (std::size_t i = 0, n = this->conditions.size(); i < n; ++i) {
39 const Condition& condition = this->conditions[i];
40
41 const SettingData* setting_data = ::FindSetting<SettingData>(data_set, condition.setting->key.c_str());
42 if (setting_data->type == SETTING_FLAGS && condition.setting->type == SETTING_FLAGS) {
43 const SettingDataFlags* settings_flags = static_cast<const SettingDataFlags*>(setting_data);
44 const SettingDataFlags* condition_flags = static_cast<const SettingDataFlags*>(condition.setting);
45
46 if (condition.op == CONDITION_OPERATOR_NOT) {
47 bool all_not_found = true;
48
49 for (std::size_t i = 0, n = condition_flags->value.size(); i < n; ++i) {
50 bool found = std::find(settings_flags->value.begin(), settings_flags->value.end(), condition_flags->value[i]) !=
51 settings_flags->value.end();
52
53 if (found) {
54 all_not_found = false;
55 break;
56 }
57 }
58
59 if (!all_not_found) {
60 result = false;
61 break;
62 }
63 } else {
64 bool all_found = true;
65
66 for (std::size_t i = 0, n = condition_flags->value.size(); i < n; ++i) {
67 bool found = std::find(settings_flags->value.begin(), settings_flags->value.end(), condition_flags->value[i]) !=
68 settings_flags->value.end();
69
70 if (!found) {
71 all_found = false;
72 break;
73 }
74 }
75
76 if (!all_found) {
77 result = false;
78 break;
79 }
80 }
81 } else {
82 if (condition.op == CONDITION_OPERATOR_NOT) {
83 if (*condition.setting == *setting_data) {
84 result = false;
85 break;
86 }
87 } else {
88 if (*condition.setting != *setting_data) {
89 result = false;
90 break;
91 }
92 }

Callers 1

CheckMessageFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected