diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2005-07-13 15:21:30 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2005-07-13 15:21:30 (GMT) |
commit | aa47caab2db3961bfdd53036e5637df208b319d4 (patch) | |
tree | 1bd23995ec567a67fe8cccadd3750a215ea48829 /Source/cmSourceGroup.cxx | |
parent | 1e72091e8631f1a94262a1a10b58d6b0a975db01 (diff) | |
download | CMake-aa47caab2db3961bfdd53036e5637df208b319d4.zip CMake-aa47caab2db3961bfdd53036e5637df208b319d4.tar.gz CMake-aa47caab2db3961bfdd53036e5637df208b319d4.tar.bz2 |
FIX: apply patch from bug# 1965
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; +} |