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

Method parse

source/MRIOExtras/MRSvg.cpp:389–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

387 std::string error() const { return doc_.ErrorStr(); }
388
389 Expected<Polyline2> parse()
390 {
391 auto* svg = doc_.RootElement();
392 if ( !svg || svg->Name() != std::string_view{ "svg" } )
393 return unexpected( "Not an SVG document" );
394
395 if ( auto contours = parseChildren_( svg ) )
396 {
397 Polyline2 result{ *contours };
398 // flip Y axis
399 for ( auto& p : result.points )
400 p.y *= -1.f;
401 return result;
402 }
403 else
404 {
405 return unexpected( std::move( contours.error() ) );
406 }
407 }
408
409private:
410 Expected<Contours2f> parseChildren_( XMLElement* group ) const

Callers 6

test_download_fileFunction · 0.80
deserializeJsonValueFunction · 0.80
fromSvgFunction · 0.80
process_fileFunction · 0.80
find_missing_entriesFunction · 0.80
junit_to_csv.pyFile · 0.80

Calls 2

errorMethod · 0.80
unexpectedFunction · 0.50

Tested by

no test coverage detected