------------------------------------------------------------------------------
| 714 | |
| 715 | //------------------------------------------------------------------------------ |
| 716 | std::size_t vtkStatisticsAlgorithm::ConsumeStringTuple( |
| 717 | const std::string& source, std::vector<std::string>& tuple) |
| 718 | { |
| 719 | std::string work = source; |
| 720 | std::string value; |
| 721 | std::size_t consumed = 0; |
| 722 | std::size_t stringSize; |
| 723 | std::size_t ii; |
| 724 | tuple.clear(); |
| 725 | for (ii = 0; ii < work.size(); work = work.substr(stringSize, std::string::npos)) |
| 726 | { |
| 727 | if ((work[ii] == '(' && tuple.empty()) || (work[ii] == ',' && !tuple.empty())) |
| 728 | { |
| 729 | work = work.substr(1, std::string::npos); |
| 730 | ++consumed; |
| 731 | |
| 732 | // Handle an empty tuple with no strings |
| 733 | if (work[ii] == ')') |
| 734 | { |
| 735 | ++consumed; |
| 736 | return consumed; |
| 737 | } |
| 738 | |
| 739 | stringSize = ConsumeString(work, value); |
| 740 | if (stringSize == 0) |
| 741 | { |
| 742 | return 0; |
| 743 | } |
| 744 | consumed += stringSize; |
| 745 | tuple.push_back(value); |
| 746 | } |
| 747 | else if (work[ii] == ')' && consumed > 0) |
| 748 | { |
| 749 | ++consumed; |
| 750 | return consumed; |
| 751 | } |
| 752 | else |
| 753 | { |
| 754 | return 0; |
| 755 | } |
| 756 | } |
| 757 | return 0; |
| 758 | } |
| 759 | |
| 760 | //------------------------------------------------------------------------------ |
| 761 | std::size_t vtkStatisticsAlgorithm::ConsumeStringTuple( |
no test coverage detected