| 155 | } |
| 156 | |
| 157 | std::unique_ptr<SkeletonConfig> SkeletonConfig::parse( |
| 158 | std::string_view src, |
| 159 | std::string_view file, |
| 160 | std::string_view name |
| 161 | ) { |
| 162 | auto root = json::parse(file, src); |
| 163 | auto rootNodeMap = root->map("root"); |
| 164 | if (rootNodeMap == nullptr) { |
| 165 | throw std::runtime_error("missing 'root' element"); |
| 166 | } |
| 167 | auto [count, rootNode] = read_node(rootNodeMap, 0); |
| 168 | return std::make_unique<SkeletonConfig>(std::string(name), std::move(rootNode), count); |
| 169 | } |