MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / parsePolygon

Function parsePolygon

source/MRMesh/MRIOParsing.cpp:333–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331}
332
333Expected<void> parsePolygon( const std::string_view& str, VertId* vertId, int* numPoints)
334{
335 using namespace boost::spirit::x3;
336
337 bool r = false;
338 size_t vi = 0;
339 auto v = [&] ( auto& ctx ) { vertId[vi++] = VertId( _attr( ctx ) ); };
340 if ( numPoints )
341 {
342 auto n = [&] ( auto& ctx ) { *numPoints = _attr( ctx ); };
343 r = phrase_parse(
344 str.begin(),
345 str.end(),
346 int_[n] >> *int_[v],
347 ascii::space );
348 }
349 else
350 {
351 auto n = [&] ( auto& ) { };
352 r = phrase_parse(
353 str.begin(),
354 str.end(),
355 int_[n] >> *int_[v],
356 ascii::space );
357 }
358
359 if ( !r )
360 {
361 return unexpected( "Failed to parse face in OFF-file" );
362 }
363
364 return {};
365}
366
367bool hasBom( const std::string_view& str )
368{

Callers 1

fromOffFunction · 0.85

Calls 3

unexpectedFunction · 0.70
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected