diff options
author | Brad King <brad.king@kitware.com> | 2003-07-23 19:32:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2003-07-23 19:32:54 (GMT) |
commit | 48aedb2ba39621a75065a4b4bc5aca7ea695c65a (patch) | |
tree | a0e0608e847a321dd15e681998b2eb0565e74b23 /Source/cmSourceGroup.cxx | |
parent | e093bdade050419290a1535ced1ca11fe7f8a2d5 (diff) | |
download | CMake-48aedb2ba39621a75065a4b4bc5aca7ea695c65a.zip CMake-48aedb2ba39621a75065a4b4bc5aca7ea695c65a.tar.gz CMake-48aedb2ba39621a75065a4b4bc5aca7ea695c65a.tar.bz2 |
ENH: Fully implemented SOURCE_GROUP command.
Diffstat (limited to 'Source/cmSourceGroup.cxx')
-rw-r--r-- | Source/cmSourceGroup.cxx | 76 |
1 files changed, 51 insertions, 25 deletions
diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx index 706547d..035b643 100644 --- a/Source/cmSourceGroup.cxx +++ b/Source/cmSourceGroup.cxx @@ -16,42 +16,68 @@ =========================================================================*/ #include "cmSourceGroup.h" - -/** - * The constructor initializes the group's regular expression. - */ -cmSourceGroup::cmSourceGroup(const char* name, const char* regex): - m_Name(name), - m_GroupRegex(regex) +//---------------------------------------------------------------------------- +cmSourceGroup::cmSourceGroup(const char* name, const char* regex): m_Name(name) { + this->SetGroupRegex(regex); } - -/** - * Copy constructor. - */ -cmSourceGroup::cmSourceGroup(const cmSourceGroup& r): - m_Name(r.m_Name), - m_GroupRegex(r.m_GroupRegex), - m_SourceFiles(r.m_SourceFiles) +//---------------------------------------------------------------------------- +void cmSourceGroup::SetGroupRegex(const char* regex) { + if(regex) + { + m_GroupRegex.compile(regex); + } + else + { + m_GroupRegex.compile("^$"); + } } - - -/** - * Returns whether the given name matches the group's regular expression. - */ -bool cmSourceGroup::Matches(const char* name) + +//---------------------------------------------------------------------------- +void cmSourceGroup::AddGroupFile(const char* name) +{ + m_GroupFiles.insert(name); +} + +//---------------------------------------------------------------------------- +const char* cmSourceGroup::GetName() const +{ + return m_Name.c_str(); +} + +//---------------------------------------------------------------------------- +bool cmSourceGroup::MatchesRegex(const char* name) { return m_GroupRegex.find(name); } +//---------------------------------------------------------------------------- +bool cmSourceGroup::MatchesFiles(const char* name) +{ + std::set<cmStdString>::const_iterator i = m_GroupFiles.find(name); + if(i != m_GroupFiles.end()) + { + return true; + } + return false; +} -/** - * Add a source to the group that the compiler will know how to build. - */ -void cmSourceGroup::AddSource(const char* /* name */, const cmSourceFile* sf) +//---------------------------------------------------------------------------- +void cmSourceGroup::AssignSource(const cmSourceFile* sf) { m_SourceFiles.push_back(sf); } +//---------------------------------------------------------------------------- +const std::vector<const cmSourceFile*>& cmSourceGroup::GetSourceFiles() const +{ + return m_SourceFiles; +} + +//---------------------------------------------------------------------------- +std::vector<const cmSourceFile*>& cmSourceGroup::GetSourceFiles() +{ + return m_SourceFiles; +} |