| 81 | }; |
| 82 | |
| 83 | std::string get_JSONstring(const std::string& key) { |
| 84 | std::string uppercase_identifier = upper(key); |
| 85 | // Try to find it |
| 86 | auto it = JSONstring_map.find(uppercase_identifier); |
| 87 | // If it is found |
| 88 | if (it == JSONstring_map.end()) { |
| 89 | auto italias = aliases_map.find(uppercase_identifier); |
| 90 | if (italias != aliases_map.end()) { |
| 91 | // Alias was found, use it to get the fluid name, and then the cubic values |
| 92 | it = JSONstring_map.find(italias->second); |
| 93 | } else { |
| 94 | throw ValueError(format("Fluid identifier [%s] was not found in CubicsLibrary", uppercase_identifier.c_str())); |
| 95 | } |
| 96 | } |
| 97 | // Then, wrap the single fluid object in an array, as callers expect |
| 98 | nlohmann::json doc = cpjson::parse(it->second); |
| 99 | nlohmann::json doc2 = nlohmann::json::array(); |
| 100 | doc2.push_back(doc); |
| 101 | return doc2.dump(); |
| 102 | } |
| 103 | |
| 104 | CubicsValues get(const std::string& identifier) { |
| 105 | std::string uppercase_identifier = upper(identifier); |
no test coverage detected