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

Function percentDecode

source/MRViewer/MRFileDialogPortal.cpp:358–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356}
357
358std::string percentDecode( std::string_view str )
359{
360 std::string result;
361 size_t cur = 0;
362 for ( auto pos = str.find( '%' ); pos != std::string_view::npos; pos = str.find( '%', cur ) )
363 {
364 result.append( str.substr( cur, pos - cur ) );
365 cur = pos + 3;
366 if ( str.size() < cur )
367 return result;
368
369 const auto* substr = str.data() + pos;
370 char decoded = fromHex( substr[1] ) * 0x10 + fromHex( substr[2] );
371 result.append( { decoded } );
372 }
373 result.append( str.substr( cur ) );
374 return result;
375}
376
377} // namespace
378

Callers 1

runPortalFileDialogFunction · 0.85

Calls 4

fromHexFunction · 0.85
findMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected