diff options
author | Brad King <brad.king@kitware.com> | 2008-05-16 20:56:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-05-16 20:56:41 (GMT) |
commit | 10db44a81d7be2ebd93c7fb1b70883d62c421723 (patch) | |
tree | ddb8cae9ff9eb79733d7eb54b5fc8b1d637e0903 | |
parent | f43748e1dd656a4b9c5f2d59ece64618a51efba5 (diff) | |
download | CMake-10db44a81d7be2ebd93c7fb1b70883d62c421723.zip CMake-10db44a81d7be2ebd93c7fb1b70883d62c421723.tar.gz CMake-10db44a81d7be2ebd93c7fb1b70883d62c421723.tar.bz2 |
COMP: Fix build with concept checking of STL.
- Fix cmSourceGroup to not use std::vector with an incomplete type.
-rw-r--r-- | Source/cmLocalVisualStudio6Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmSourceGroup.cxx | 59 | ||||
-rw-r--r-- | Source/cmSourceGroup.h | 10 |
4 files changed, 59 insertions, 14 deletions
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 3ddac13..b396f22 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -532,7 +532,7 @@ void cmLocalVisualStudio6Generator } } - std::vector<cmSourceGroup> children = sg->GetGroupChildren(); + std::vector<cmSourceGroup> const& children = sg->GetGroupChildren(); for(unsigned int i=0;i<children.size();++i) { diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index d25962b..5f4ddf5 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1473,7 +1473,7 @@ void cmLocalVisualStudio7Generator } } - std::vector<cmSourceGroup> children = sg->GetGroupChildren(); + std::vector<cmSourceGroup> const& children = sg->GetGroupChildren(); for(unsigned int i=0;i<children.size();++i) { diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx index f98eeef..d64ba3e 100644 --- a/Source/cmSourceGroup.cxx +++ b/Source/cmSourceGroup.cxx @@ -16,13 +16,47 @@ =========================================================================*/ #include "cmSourceGroup.h" +class cmSourceGroupInternals +{ +public: + std::vector<cmSourceGroup> GroupChildren; +}; + //---------------------------------------------------------------------------- cmSourceGroup::cmSourceGroup(const char* name, const char* regex): Name(name) { + this->Internal = new cmSourceGroupInternals; this->SetGroupRegex(regex); } //---------------------------------------------------------------------------- +cmSourceGroup::~cmSourceGroup() +{ + delete this->Internal; +} + +//---------------------------------------------------------------------------- +cmSourceGroup::cmSourceGroup(cmSourceGroup const& r) +{ + this->Name = r.Name; + this->GroupRegex = r.GroupRegex; + this->GroupFiles = r.GroupFiles; + this->SourceFiles = r.SourceFiles; + this->Internal = new cmSourceGroupInternals(*r.Internal); +} + +//---------------------------------------------------------------------------- +cmSourceGroup& cmSourceGroup::operator=(cmSourceGroup const& r) +{ + this->Name = r.Name; + this->GroupRegex = r.GroupRegex; + this->GroupFiles = r.GroupFiles; + this->SourceFiles = r.SourceFiles; + *(this->Internal) = *(r.Internal); + return *this; +} + +//---------------------------------------------------------------------------- void cmSourceGroup::SetGroupRegex(const char* regex) { if(regex) @@ -85,15 +119,17 @@ std::vector<const cmSourceFile*>& cmSourceGroup::GetSourceFiles() //---------------------------------------------------------------------------- void cmSourceGroup::AddChild(cmSourceGroup child) { - this->GroupChildren.push_back(child); + this->Internal->GroupChildren.push_back(child); } //---------------------------------------------------------------------------- cmSourceGroup *cmSourceGroup::lookupChild(const char* name) { // initializing iterators - std::vector<cmSourceGroup>::iterator iter = this->GroupChildren.begin(); - std::vector<cmSourceGroup>::iterator end = this->GroupChildren.end(); + std::vector<cmSourceGroup>::iterator iter = + this->Internal->GroupChildren.begin(); + std::vector<cmSourceGroup>::iterator end = + this->Internal->GroupChildren.end(); // st for(;iter!=end; ++iter) @@ -114,8 +150,10 @@ cmSourceGroup *cmSourceGroup::lookupChild(const char* name) cmSourceGroup *cmSourceGroup::MatchChildrenFiles(const char *name) { // initializing iterators - std::vector<cmSourceGroup>::iterator iter = this->GroupChildren.begin(); - std::vector<cmSourceGroup>::iterator end = this->GroupChildren.end(); + std::vector<cmSourceGroup>::iterator iter = + this->Internal->GroupChildren.begin(); + std::vector<cmSourceGroup>::iterator end = + this->Internal->GroupChildren.end(); if(this->MatchesFiles(name)) { @@ -136,8 +174,10 @@ cmSourceGroup *cmSourceGroup::MatchChildrenFiles(const char *name) cmSourceGroup *cmSourceGroup::MatchChildrenRegex(const char *name) { // initializing iterators - std::vector<cmSourceGroup>::iterator iter = this->GroupChildren.begin(); - std::vector<cmSourceGroup>::iterator end = this->GroupChildren.end(); + std::vector<cmSourceGroup>::iterator iter = + this->Internal->GroupChildren.begin(); + std::vector<cmSourceGroup>::iterator end = + this->Internal->GroupChildren.end(); if(this->MatchesRegex(name)) { @@ -154,7 +194,8 @@ cmSourceGroup *cmSourceGroup::MatchChildrenRegex(const char *name) return 0; } -std::vector<cmSourceGroup> cmSourceGroup::GetGroupChildren() const +std::vector<cmSourceGroup> const& +cmSourceGroup::GetGroupChildren() const { - return this->GroupChildren; + return this->Internal->GroupChildren; } diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h index e48fa10..1e64bc1 100644 --- a/Source/cmSourceGroup.h +++ b/Source/cmSourceGroup.h @@ -22,6 +22,8 @@ class cmSourceFile; +class cmSourceGroupInternals; + /** \class cmSourceGroup * \brief Hold a group of sources as specified by a SOURCE_GROUP command. * @@ -36,7 +38,9 @@ class cmSourceGroup { public: cmSourceGroup(const char* name, const char* regex); - ~cmSourceGroup() {} + cmSourceGroup(cmSourceGroup const& r); + ~cmSourceGroup(); + cmSourceGroup& operator=(cmSourceGroup const&); /** * Set the regular expression for this group. @@ -97,7 +101,7 @@ public: const std::vector<const cmSourceFile*>& GetSourceFiles() const; std::vector<const cmSourceFile*>& GetSourceFiles(); - std::vector<cmSourceGroup> GetGroupChildren() const; + std::vector<cmSourceGroup> const& GetGroupChildren() const; private: /** * The name of the source group. @@ -120,7 +124,7 @@ private: */ std::vector<const cmSourceFile*> SourceFiles; - std::vector<cmSourceGroup> GroupChildren; + cmSourceGroupInternals* Internal; }; #endif |