| 71 | |
| 72 | |
| 73 | void Handler::LoadProtocolProfiles(const std::string &profile_dir) |
| 74 | { |
| 75 | namespace fs = std::filesystem; |
| 76 | |
| 77 | try |
| 78 | { |
| 79 | for (const auto &entry : fs::directory_iterator(profile_dir)) |
| 80 | { |
| 81 | auto p = entry.path(); |
| 82 | |
| 83 | if (p.extension() == ".json") |
| 84 | { |
| 85 | std::ifstream profile_stream(p, std::ios::in | std::ios::binary); |
| 86 | Json::Value profile_json; |
| 87 | |
| 88 | profile_stream >> profile_json; |
| 89 | |
| 90 | profiles_[p.stem()] = profile_json; |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | catch (const std::exception &e) |
| 95 | { |
| 96 | using namespace std::string_literals; |
| 97 | |
| 98 | signals_->LogError("Error parsing protocol profiles: "s + e.what()); |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | |
| 103 | Json::Value Handler::compose_json(const Module::Dictionary &dict, const Json::Value &result_mapping) const |
no test coverage detected