MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / GetProperty

Method GetProperty

lib/mdflib/mdflib/src/mdlist.cpp:134–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134const MdProperty* MdList::GetProperty(const std::string& name) const {
135 const size_t separator = name.find_first_of('/');
136 if (separator == std::string::npos) {
137 // Fetch the property
138 if (const auto itr_prop = property_list_.find(name);
139 itr_prop != property_list_.cend()) {
140 return &itr_prop->second;
141 }
142
143 for (const auto& [tree_name, tree] : tree_list_) {
144 if (const MdProperty* temp = tree.GetProperty(name);
145 temp != nullptr) {
146 return temp;
147 }
148 }
149
150 for (const auto& [list_name, list] : list_list_) {
151 if (const MdProperty* temp = list.GetProperty(name);
152 temp != nullptr) {
153 return temp;
154 }
155 }
156 } else {
157 const auto prop_name = name.substr(separator + 1);
158 for (const auto& [tree_name, tree] : tree_list_) {
159 if (const MdProperty* temp = tree.GetProperty(prop_name);
160 temp != nullptr) {
161 return temp;
162 }
163 }
164
165 for (const auto& [list_name, list] : list_list_) {
166 if (const MdProperty* temp = list.GetProperty(prop_name);
167 temp != nullptr) {
168 return temp;
169 }
170 }
171 }
172 return nullptr;
173}
174
175
176const MdEnumerate* MdList::GetEnumerate(const std::string& name) const {

Callers 1

TESTFunction · 0.45

Calls 2

findMethod · 0.80
cendMethod · 0.80

Tested by 1

TESTFunction · 0.36