/////////////////////////////////////////////////////////////////////////// Try a JSON parse.
| 523 | //////////////////////////////////////////////////////////////////////////////// |
| 524 | // Try a JSON parse. |
| 525 | void Task::parse(const std::string& input) { |
| 526 | parseJSON(input); |
| 527 | |
| 528 | // for compatibility, include all tags in `tags` as `tag_..` attributes |
| 529 | if (data.find("tags") != data.end()) { |
| 530 | for (auto& tag : split(data["tags"], ',')) { |
| 531 | data[tag2Attr(tag)] = "x"; |
| 532 | } |
| 533 | } |
| 534 | // ..and similarly, update `tags` to match the `tag_..` attributes |
| 535 | fixTagsAttribute(); |
| 536 | |
| 537 | // same for `depends` / `dep_..` |
| 538 | if (data.find("depends") != data.end()) { |
| 539 | for (auto& dep : split(data["depends"], ',')) { |
| 540 | data[dep2Attr(dep)] = "x"; |
| 541 | } |
| 542 | } |
| 543 | fixDependsAttribute(); |
| 544 | |
| 545 | recalc_urgency = true; |
| 546 | } |
| 547 | |
| 548 | //////////////////////////////////////////////////////////////////////////////// |
| 549 | // Note that all fields undergo encode/decode. |