| 736 | } |
| 737 | |
| 738 | TokenList tokenListFromJson(const rapidjson::Value& json) { |
| 739 | TokenList result; |
| 740 | |
| 741 | const auto itemsIt = json.FindMember("items"); |
| 742 | if (itemsIt != json.MemberEnd() && itemsIt->value.IsArray()) { |
| 743 | const rapidjson::Value& items = itemsIt->value; |
| 744 | |
| 745 | for (auto it = items.Begin(); it != items.End(); ++it) { |
| 746 | std::optional<Token> token = tokenFromJson(*it); |
| 747 | if (!token) { |
| 748 | continue; |
| 749 | } |
| 750 | |
| 751 | result.items.emplace_back(std::move(token.value())); |
| 752 | } |
| 753 | } |
| 754 | |
| 755 | return result; |
| 756 | } |
| 757 | |
| 758 | } // namespace |
| 759 | |