MCPcopy Create free account
hub / github.com/Kitware/VTK / ConsumeStringTuple

Method ConsumeStringTuple

Filters/Statistics/vtkStatisticsAlgorithm.cxx:716–758  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

714
715//------------------------------------------------------------------------------
716std::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//------------------------------------------------------------------------------
761std::size_t vtkStatisticsAlgorithm::ConsumeStringTuple(

Callers 1

Calls 7

clearMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45
SetNumberOfValuesMethod · 0.45
SetValueMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected