Add label summary times to ctest default output. Also, remove parallel time output...
[cmake.git] / Source / cmSourceGroup.cxx
blob5d8b6bd0121736be588f14e65f5dbd988fa82298
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmSourceGroup.cxx,v $
5 Language: C++
6 Date: $Date: 2009-07-11 04:05:20 $
7 Version: $Revision: 1.21 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #include "cmSourceGroup.h"
19 class cmSourceGroupInternals
21 public:
22 std::vector<cmSourceGroup> GroupChildren;
25 //----------------------------------------------------------------------------
26 cmSourceGroup::cmSourceGroup(const char* name, const char* regex,
27 const char* parentName): Name(name)
29 this->Internal = new cmSourceGroupInternals;
30 this->SetGroupRegex(regex);
31 if(parentName)
33 this->FullName = parentName;
34 this->FullName += "\\";
36 this->FullName += this->Name;
39 //----------------------------------------------------------------------------
40 cmSourceGroup::~cmSourceGroup()
42 delete this->Internal;
45 //----------------------------------------------------------------------------
46 cmSourceGroup::cmSourceGroup(cmSourceGroup const& r)
48 this->Name = r.Name;
49 this->FullName = r.FullName;
50 this->GroupRegex = r.GroupRegex;
51 this->GroupFiles = r.GroupFiles;
52 this->SourceFiles = r.SourceFiles;
53 this->Internal = new cmSourceGroupInternals(*r.Internal);
56 //----------------------------------------------------------------------------
57 cmSourceGroup& cmSourceGroup::operator=(cmSourceGroup const& r)
59 this->Name = r.Name;
60 this->GroupRegex = r.GroupRegex;
61 this->GroupFiles = r.GroupFiles;
62 this->SourceFiles = r.SourceFiles;
63 *(this->Internal) = *(r.Internal);
64 return *this;
67 //----------------------------------------------------------------------------
68 void cmSourceGroup::SetGroupRegex(const char* regex)
70 if(regex)
72 this->GroupRegex.compile(regex);
74 else
76 this->GroupRegex.compile("^$");
80 //----------------------------------------------------------------------------
81 void cmSourceGroup::AddGroupFile(const char* name)
83 this->GroupFiles.insert(name);
86 //----------------------------------------------------------------------------
87 const char* cmSourceGroup::GetName() const
89 return this->Name.c_str();
92 //----------------------------------------------------------------------------
93 const char* cmSourceGroup::GetFullName() const
95 return this->FullName.c_str();
98 //----------------------------------------------------------------------------
99 bool cmSourceGroup::MatchesRegex(const char* name)
101 return this->GroupRegex.find(name);
104 //----------------------------------------------------------------------------
105 bool cmSourceGroup::MatchesFiles(const char* name)
107 std::set<cmStdString>::const_iterator i = this->GroupFiles.find(name);
108 if(i != this->GroupFiles.end())
110 return true;
112 return false;
115 //----------------------------------------------------------------------------
116 void cmSourceGroup::AssignSource(const cmSourceFile* sf)
118 this->SourceFiles.push_back(sf);
121 //----------------------------------------------------------------------------
122 const std::vector<const cmSourceFile*>& cmSourceGroup::GetSourceFiles() const
124 return this->SourceFiles;
127 //----------------------------------------------------------------------------
128 std::vector<const cmSourceFile*>& cmSourceGroup::GetSourceFiles()
130 return this->SourceFiles;
133 //----------------------------------------------------------------------------
134 void cmSourceGroup::AddChild(cmSourceGroup child)
136 this->Internal->GroupChildren.push_back(child);
139 //----------------------------------------------------------------------------
140 cmSourceGroup *cmSourceGroup::lookupChild(const char* name)
142 // initializing iterators
143 std::vector<cmSourceGroup>::iterator iter =
144 this->Internal->GroupChildren.begin();
145 std::vector<cmSourceGroup>::iterator end =
146 this->Internal->GroupChildren.end();
148 // st
149 for(;iter!=end; ++iter)
151 std::string sgName = iter->GetName();
153 // look if descenened is the one were looking for
154 if(sgName == name)
156 return &(*iter); // if it so return it
160 // if no child with this name was found return NULL
161 return NULL;
164 cmSourceGroup *cmSourceGroup::MatchChildrenFiles(const char *name)
166 // initializing iterators
167 std::vector<cmSourceGroup>::iterator iter =
168 this->Internal->GroupChildren.begin();
169 std::vector<cmSourceGroup>::iterator end =
170 this->Internal->GroupChildren.end();
172 if(this->MatchesFiles(name))
174 return this;
176 for(;iter!=end;++iter)
178 cmSourceGroup *result = iter->MatchChildrenFiles(name);
179 if(result)
181 return result;
184 return 0;
188 cmSourceGroup *cmSourceGroup::MatchChildrenRegex(const char *name)
190 // initializing iterators
191 std::vector<cmSourceGroup>::iterator iter =
192 this->Internal->GroupChildren.begin();
193 std::vector<cmSourceGroup>::iterator end =
194 this->Internal->GroupChildren.end();
196 if(this->MatchesRegex(name))
198 return this;
200 for(;iter!=end; ++iter)
202 cmSourceGroup *result = iter->MatchChildrenRegex(name);
203 if(result)
205 return result;
208 return 0;
211 std::vector<cmSourceGroup> const&
212 cmSourceGroup::GetGroupChildren() const
214 return this->Internal->GroupChildren;