| 132 | } |
| 133 | |
| 134 | const 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 | |
| 176 | const MdEnumerate* MdList::GetEnumerate(const std::string& name) const { |