| 601 | } |
| 602 | |
| 603 | std::vector<uint32_t> unicode_cpts_normalize_nfd(const std::vector<uint32_t> & cpts) { |
| 604 | auto comp = [] (const uint32_t cpt, const range_nfd & range) { |
| 605 | return cpt < range.first; |
| 606 | }; |
| 607 | std::vector<uint32_t> result(cpts.size()); |
| 608 | for (size_t i = 0; i < cpts.size(); ++i) { |
| 609 | const uint32_t cpt = cpts[i]; |
| 610 | auto it = std::upper_bound(unicode_ranges_nfd.begin(), unicode_ranges_nfd.end(), cpt, comp) - 1; |
| 611 | result[i] = (it->first <= cpt && cpt <= it->last) ? it->nfd : cpt; |
| 612 | } |
| 613 | return result; |
| 614 | } |
| 615 | |
| 616 | std::vector<uint32_t> unicode_cpts_from_utf8(const std::string & utf8) { |
| 617 | std::vector<uint32_t> result; |
no test coverage detected