MCPcopy Create free account
hub / github.com/MrKepzie/Natron / matchPath

Method matchPath

Engine/FileSystemModel.cpp:426–445  ·  view source on GitHub ↗

This is a recursive method which tries to match a path to a specifiq FileSystemItem item which has the path; Here startIndex is the position of the separator

Source from the content-addressed store, hash-verified

424// FileSystemItem item which has the path;
425// Here startIndex is the position of the separator
426boost::shared_ptr<FileSystemItem>
427FileSystemItem::matchPath(const QStringList& path,
428 int startIndex) const
429{
430 const QString& pathBit = path.at(startIndex);
431
432 for (U32 i = 0; i < _imp->children.size(); ++i) {
433 const boost::shared_ptr<FileSystemItem>& child = _imp->children[i];
434
435 if ( child && (child->fileName() == pathBit) ) {
436 if (startIndex == path.size() - 1) {
437 return child;
438 } else {
439 return child->matchPath(path, startIndex + 1);
440 }
441 }
442 }
443
444 return boost::shared_ptr<FileSystemItem>();
445}
446
447//////////////FileSystemModel
448

Callers 1

getItemFromPathMethod · 0.80

Calls 2

atMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected