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

Function commonClassName

source/MRViewer/MRViewer.cpp:1244–1258  ·  view source on GitHub ↗

returns class name of all objects or nullopt if they are of different types

Source from the content-addressed store, hash-verified

1242
1243/// returns class name of all objects or nullopt if they are of different types
1244static std::optional<std::string> commonClassName( const std::vector<std::shared_ptr<Object>>& objs )
1245{
1246 if ( objs.empty() )
1247 return {};
1248
1249 auto cn = objs[0]->className();
1250 if ( objs.size() == 1 )
1251 return cn;
1252
1253 for ( int i = 1; i < objs.size(); ++i )
1254 if ( cn != objs[i]->className() )
1255 return {};
1256
1257 return objs[0]->classNameInPlural();
1258}
1259
1260bool Viewer::loadFiles( const std::vector<std::filesystem::path>& filesList )
1261{

Callers 1

loadFilesMethod · 0.85

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected