cmMakefile: Make FindSourceGroup const.

Return a pointer instead of a reference.  This allows making the accessor
const with the least impact.
This commit is contained in:
Stephen Kelly 2014-01-21 16:43:47 +01:00
parent 01d7ceda5d
commit bf1e1bf1d0
7 changed files with 21 additions and 21 deletions

View File

@ -567,9 +567,9 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
{
// Add the file to the list of sources.
std::string source = (*sfIt)->GetFullPath();
cmSourceGroup& sourceGroup =
cmSourceGroup* sourceGroup =
makefile->FindSourceGroup(source.c_str(), sourceGroups);
sourceGroup.AssignSource(*sfIt);
sourceGroup->AssignSource(*sfIt);
}
for(std::vector<cmSourceGroup>::iterator sgIt = sourceGroups.begin();

View File

@ -2960,10 +2960,10 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
cmSourceFile* sf = *s;
// Add the file to the list of sources.
std::string const& source = sf->GetFullPath();
cmSourceGroup& sourceGroup =
cmSourceGroup* sourceGroup =
mf->FindSourceGroup(source.c_str(), sourceGroups);
cmXCodeObject* pbxgroup =
this->CreateOrGetPBXGroup(cmtarget, &sourceGroup);
this->CreateOrGetPBXGroup(cmtarget, sourceGroup);
cmStdString key = GetGroupMapKey(cmtarget, sf);
this->GroupMap[key] = pbxgroup;
}
@ -2975,10 +2975,10 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
oi = objs.begin(); oi != objs.end(); ++oi)
{
std::string const& source = *oi;
cmSourceGroup& sourceGroup =
cmSourceGroup* sourceGroup =
mf->FindSourceGroup(source.c_str(), sourceGroups);
cmXCodeObject* pbxgroup =
this->CreateOrGetPBXGroup(cmtarget, &sourceGroup);
this->CreateOrGetPBXGroup(cmtarget, sourceGroup);
cmStdString key = GetGroupMapKeyFromPath(cmtarget, source);
this->GroupMap[key] = pbxgroup;
}

View File

@ -324,9 +324,9 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
{
// Add the file to the list of sources.
std::string source = (*i)->GetFullPath();
cmSourceGroup& sourceGroup =
cmSourceGroup* sourceGroup =
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
sourceGroup.AssignSource(*i);
sourceGroup->AssignSource(*i);
// while we are at it, if it is a .rule file then for visual studio 6 we
// must generate it
if ((*i)->GetPropertyAsBool("__CMAKE_RULE"))

View File

@ -1392,9 +1392,9 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
{
this->ModuleDefinitionFile = (*i)->GetFullPath();
}
cmSourceGroup& sourceGroup =
cmSourceGroup* sourceGroup =
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
sourceGroup.AssignSource(*i);
sourceGroup->AssignSource(*i);
}
// open the project

View File

@ -2775,9 +2775,9 @@ cmMakefile::GetConfigurations(std::vector<std::string>& configs,
* non-inherited SOURCE_GROUP commands will have precedence over
* inherited ones.
*/
cmSourceGroup&
cmSourceGroup*
cmMakefile::FindSourceGroup(const char* source,
std::vector<cmSourceGroup> &groups)
std::vector<cmSourceGroup> &groups) const
{
// First search for a group that lists the file explicitly.
for(std::vector<cmSourceGroup>::reverse_iterator sg = groups.rbegin();
@ -2786,7 +2786,7 @@ cmMakefile::FindSourceGroup(const char* source,
cmSourceGroup *result = sg->MatchChildrenFiles(source);
if(result)
{
return *result;
return result;
}
}
@ -2797,13 +2797,13 @@ cmMakefile::FindSourceGroup(const char* source,
cmSourceGroup *result = sg->MatchChildrenRegex(source);
if(result)
{
return *result;
return result;
}
}
// Shouldn't get here, but just in case, return the default group.
return groups.front();
return &groups.front();
}
#endif

View File

@ -706,8 +706,8 @@ public:
/**
* find what source group this source is in
*/
cmSourceGroup& FindSourceGroup(const char* source,
std::vector<cmSourceGroup> &groups);
cmSourceGroup* FindSourceGroup(const char* source,
std::vector<cmSourceGroup> &groups) const;
#endif
/**

View File

@ -708,9 +708,9 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
{
cmSourceFile* sf = *s;
std::string const& source = sf->GetFullPath();
cmSourceGroup& sourceGroup =
cmSourceGroup* sourceGroup =
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
groupsUsed.insert(&sourceGroup);
groupsUsed.insert(sourceGroup);
}
this->AddMissingSourceGroups(groupsUsed, sourceGroups);
@ -901,9 +901,9 @@ WriteGroupSources(const char* name,
{
cmSourceFile* sf = s->SourceFile;
std::string const& source = sf->GetFullPath();
cmSourceGroup& sourceGroup =
cmSourceGroup* sourceGroup =
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
const char* filter = sourceGroup.GetFullName();
const char* filter = sourceGroup->GetFullName();
this->WriteString("<", 2);
std::string path = this->ConvertPath(source, s->RelativePath);
this->ConvertToWindowsSlash(path);