MCPcopy Create free account
hub / github.com/ImageEngine/cortex / initWrapper

Function initWrapper

src/IECorePython/PathMatcherBinding.cpp:257–274  ·  view source on GitHub ↗

we don't actually wrap the existing init, but rather reimplement it here using clear() and addPath(), so that we can support a mixture of strings and InternedStringVectorData.

Source from the content-addressed store, hash-verified

255// here using clear() and addPath(), so that we can support a mixture
256// of strings and InternedStringVectorData.
257void initWrapper( PathMatcher &m, boost::python::object paths )
258{
259 m.clear();
260 for( size_t i = 0, e = len( paths ); i < e; ++i )
261 {
262 object path = paths[i];
263 extract<const IECore::InternedStringVectorData *> pathDataExtractor( path );
264 const IECore::InternedStringVectorData *pathData = pathDataExtractor.check() ? pathDataExtractor() : nullptr;
265 if( pathData )
266 {
267 m.addPath( pathData->readable() );
268 }
269 else
270 {
271 m.addPath( extract<std::string>( path ) );
272 }
273 }
274}
275
276PathMatcher *constructFromObject( boost::python::object oPaths )
277{

Callers 1

constructFromObjectFunction · 0.85

Calls 5

addPathMethod · 0.80
readableMethod · 0.80
lenFunction · 0.70
clearMethod · 0.45
checkMethod · 0.45

Tested by

no test coverage detected