Helper function that returns the JSON::value of a given resource (identified by 'name' and 'type') inside the resources.
| 431 | // Helper function that returns the JSON::value of a given resource (identified |
| 432 | // by 'name' and 'type') inside the resources. |
| 433 | static JSON::Value value( |
| 434 | const string& name, |
| 435 | const Value::Type& type, |
| 436 | const Resources& resources) |
| 437 | { |
| 438 | switch (type) { |
| 439 | case Value::SCALAR: |
| 440 | return resources.get<Value::Scalar>(name)->value(); |
| 441 | case Value::RANGES: |
| 442 | return stringify(resources.get<Value::Ranges>(name).get()); |
| 443 | case Value::SET: |
| 444 | return stringify(resources.get<Value::Set>(name).get()); |
| 445 | default: |
| 446 | LOG(FATAL) << "Unexpected Value type: " << type; |
| 447 | } |
| 448 | |
| 449 | UNREACHABLE(); |
| 450 | } |
| 451 | |
| 452 | |
| 453 | JSON::Object model(const Resources& resources) |
no test coverage detected