Add method Document::findObject()
This commit is contained in:
@@ -63,6 +63,7 @@ recompute path. Also enables more complicated dependencies beyond trees.
|
||||
#include <boost/graph/visitors.hpp>
|
||||
#include <boost/graph/graphviz.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
|
||||
#include "Document.h"
|
||||
@@ -1689,6 +1690,20 @@ std::vector<DocumentObject*> Document::getObjectsOfType(const Base::Type& typeId
|
||||
return Objects;
|
||||
}
|
||||
|
||||
std::vector<DocumentObject*> Document::findObjects(const Base::Type& typeId, const char* objname) const
|
||||
{
|
||||
boost::regex rx(objname);
|
||||
boost::cmatch what;
|
||||
std::vector<DocumentObject*> Objects;
|
||||
for (std::vector<DocumentObject*>::const_iterator it = d->objectArray.begin(); it != d->objectArray.end(); ++it) {
|
||||
if ((*it)->getTypeId().isDerivedFrom(typeId)) {
|
||||
if (boost::regex_match((*it)->getNameInDocument(), what, rx))
|
||||
Objects.push_back(*it);
|
||||
}
|
||||
}
|
||||
return Objects;
|
||||
}
|
||||
|
||||
int Document::countObjectsOfType(const Base::Type& typeId) const
|
||||
{
|
||||
int ct=0;
|
||||
|
||||
Reference in New Issue
Block a user