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

Method FindPositionInOriginalFunction

Common/Misc/vtkFunctionParser.cxx:2243–2278  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2241
2242//------------------------------------------------------------------------------
2243int vtkFunctionParser::FindPositionInOriginalFunction(const int& pos)
2244{
2245 // Copy the value.
2246 int origPos = pos;
2247
2248 if (this->Function && this->FunctionWithSpaces)
2249 {
2250 size_t withSpacesLen = strlen(this->FunctionWithSpaces);
2251 size_t withoutSpacesLen = strlen(this->Function);
2252
2253 int counter = 0;
2254 for (size_t i = 0; i < withSpacesLen; ++i)
2255 {
2256 // If we have covered all the characters excluding the spaces.
2257 if (counter == static_cast<int>(withoutSpacesLen) || counter == pos)
2258 {
2259 return origPos;
2260 }
2261
2262 char currentChar = this->FunctionWithSpaces[i];
2263 if (currentChar == ' ')
2264 {
2265 // Every time we hit a whitespace increment the origPos
2266 // as the pos is counted without spaces.
2267 ++origPos;
2268 continue;
2269 }
2270
2271 // This needs to be incremented for all the characters except
2272 // spaces.
2273 ++counter;
2274 }
2275 }
2276
2277 return origPos;
2278}
2279
2280//------------------------------------------------------------------------------
2281void vtkFunctionParser::UpdateNeededVariables()

Callers 1

CheckExpressionMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected