| 249 | return default_value; |
| 250 | } |
| 251 | absl::StatusOr<std::unordered_map<std::string, std::string>> |
| 252 | YamlConfig::GetSubModule(const std::string &key) const { |
| 253 | std::unordered_map<std::string, std::string> submodule_result = {}; |
| 254 | for (const auto &info : data_) { |
| 255 | if (info.first.find(key) != std::string::npos) { |
| 256 | submodule_result[info.first] = info.second; |
| 257 | } |
| 258 | } |
| 259 | if (submodule_result.empty()) { |
| 260 | return absl::NotFoundError("the " + key + " is not exits!"); |
| 261 | } |
| 262 | return submodule_result; |
| 263 | } |
| 264 | absl::Status YamlConfig::HasKey(const std::string &key) const { |
| 265 | if (data_.find(key) != data_.end()) { |
| 266 | return absl::OkStatus(); |