diff options
Diffstat (limited to 'Source/cmSourceGroup.cxx')
-rw-r--r-- | Source/cmSourceGroup.cxx | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx index 035b643..58069d1 100644 --- a/Source/cmSourceGroup.cxx +++ b/Source/cmSourceGroup.cxx @@ -81,3 +81,88 @@ std::vector<const cmSourceFile*>& cmSourceGroup::GetSourceFiles() { return m_SourceFiles; } + +//---------------------------------------------------------------------------- +void cmSourceGroup::AddChild(cmSourceGroup child) +{ + m_GroupChildren.push_back(child); +} + +//---------------------------------------------------------------------------- +cmSourceGroup *cmSourceGroup::lookupChild(const char* name) +{ + // initializing iterators + std::vector<cmSourceGroup>::iterator iter = m_GroupChildren.begin(); + std::vector<cmSourceGroup>::iterator end = m_GroupChildren.end(); + + // st + for(;iter!=end; ++iter) + { + std::string sgName = iter->GetName(); + + // look if descenened is the one were looking for + if(sgName == name) + { + return &(*iter); // if it so return it + } + // if the descendend isn't the one where looking for ask it's traverse + cmSourceGroup *result = iter->lookupChild(name); + + // if one of it's descendeds is the one we're looking for return it + if(result) + { + return result; + } + } + + // if no child with this name was found return NULL + return NULL; +} + +cmSourceGroup *cmSourceGroup::MatchChildrenFiles(const char *name) +{ + // initializing iterators + std::vector<cmSourceGroup>::iterator iter = m_GroupChildren.begin(); + std::vector<cmSourceGroup>::iterator end = m_GroupChildren.end(); + + if(this->MatchesFiles(name)) + { + return this; + } + for(;iter!=end;++iter) + { + cmSourceGroup *result = iter->MatchChildrenFiles(name); + if(result) + { + return result; + } + } + return 0; +} + + +cmSourceGroup *cmSourceGroup::MatchChildrenRegex(const char *name) +{ + // initializing iterators + std::vector<cmSourceGroup>::iterator iter = m_GroupChildren.begin(); + std::vector<cmSourceGroup>::iterator end = m_GroupChildren.end(); + + if(this->MatchesRegex(name)) + { + return this; + } + for(;iter!=end; ++iter) + { + cmSourceGroup *result = iter->MatchChildrenRegex(name); + if(result) + { + return result; + } + } + return 0; +} + +std::vector<cmSourceGroup> cmSourceGroup::GetGroupChildren() const +{ + return m_GroupChildren; +} |