STYLE: Factor CollectOriginalDirectories code

This factors code out of cmOrderDirectories::CollectOriginalDirectories
into cmOrderDirectories::AddOriginalDirectories.  Later a new call will
be added, and this is more readable anyway.
This commit is contained in:
Brad King 2009-07-14 10:14:41 -04:00
parent b44413f9f8
commit d60608c858
2 changed files with 28 additions and 20 deletions

View File

@ -393,26 +393,7 @@ void cmOrderDirectories::CollectOriginalDirectories()
// Add user directories specified for inclusion. These should be // Add user directories specified for inclusion. These should be
// indexed first so their original order is preserved as much as // indexed first so their original order is preserved as much as
// possible subject to the constraints. // possible subject to the constraints.
for(std::vector<std::string>::const_iterator this->AddOriginalDirectories(this->UserDirectories);
di = this->UserDirectories.begin();
di != this->UserDirectories.end(); ++di)
{
// We never explicitly specify implicit link directories.
if(this->ImplicitDirectories.find(*di) !=
this->ImplicitDirectories.end())
{
continue;
}
// Skip the empty string.
if(di->empty())
{
continue;
}
// Add this directory.
this->AddOriginalDirectory(*di);
}
// Add directories containing constraints. // Add directories containing constraints.
for(unsigned int i=0; i < this->ConstraintEntries.size(); ++i) for(unsigned int i=0; i < this->ConstraintEntries.size(); ++i)
@ -438,6 +419,32 @@ int cmOrderDirectories::AddOriginalDirectory(std::string const& dir)
return i->second; return i->second;
} }
//----------------------------------------------------------------------------
void
cmOrderDirectories
::AddOriginalDirectories(std::vector<std::string> const& dirs)
{
for(std::vector<std::string>::const_iterator di = dirs.begin();
di != dirs.end(); ++di)
{
// We never explicitly specify implicit link directories.
if(this->ImplicitDirectories.find(*di) !=
this->ImplicitDirectories.end())
{
continue;
}
// Skip the empty string.
if(di->empty())
{
continue;
}
// Add this directory.
this->AddOriginalDirectory(*di);
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
struct cmOrderDirectoriesCompare struct cmOrderDirectoriesCompare
{ {

View File

@ -66,6 +66,7 @@ private:
std::vector<int> DirectoryVisited; std::vector<int> DirectoryVisited;
void CollectOriginalDirectories(); void CollectOriginalDirectories();
int AddOriginalDirectory(std::string const& dir); int AddOriginalDirectory(std::string const& dir);
void AddOriginalDirectories(std::vector<std::string> const& dirs);
void FindConflicts(); void FindConflicts();
void FindImplicitConflicts(); void FindImplicitConflicts();
void OrderDirectories(); void OrderDirectories();