Commit c871446a authored by Brad King's avatar Brad King

cmSourceGroup: Return strings from GetName and GetFullName

parent 1fe9e49b
......@@ -489,7 +489,7 @@ void cmGhsMultiTargetGenerator::WriteSources(
char const* sourceFullPath = (*si)->GetFullPath().c_str();
cmSourceGroup* sourceGroup =
this->Makefile->FindSourceGroup(sourceFullPath, sourceGroups);
std::string sgPath(sourceGroup->GetFullName());
std::string sgPath = sourceGroup->GetFullName();
cmSystemTools::ConvertToUnixSlashes(sgPath);
cmGlobalGhsMultiGenerator::AddFilesUpToPath(
this->GetFolderBuildStreams(), &this->FolderBuildStreams,
......@@ -608,7 +608,7 @@ std::string cmGhsMultiTargetGenerator::ComputeLongestObjectDirectory(
cmSourceGroup* sourceGroup =
localGhsMultiGenerator->GetMakefile()->FindSourceGroup(sourceFullPath,
sourceGroups);
std::string const sgPath(sourceGroup->GetFullName());
std::string const& sgPath = sourceGroup->GetFullName();
dir_max += sgPath;
dir_max += "/Objs/libs/";
dir_max += generatorTarget->Target->GetName();
......
......@@ -2797,13 +2797,13 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(
// If it's the default source group (empty name) then put the source file
// directly in the tgroup...
//
if (std::string(sg->GetFullName()).empty()) {
if (sg->GetFullName().empty()) {
this->GroupNameMap[s] = tgroup;
return tgroup;
}
// It's a recursive folder structure, let's find the real parent group
if (std::string(sg->GetFullName()) != std::string(sg->GetName())) {
if (sg->GetFullName() != sg->GetName()) {
std::string curr_folder = target;
curr_folder += "/";
for (auto const& folder :
......
......@@ -1600,7 +1600,7 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
}
// If the group has a name, write the header.
std::string name = sg->GetName();
std::string const& name = sg->GetName();
if (!name.empty()) {
this->WriteVCProjBeginGroup(fout, name.c_str(), "");
}
......
......@@ -1950,7 +1950,7 @@ cmSourceGroup* cmMakefile::GetSourceGroup(
// first look for source group starting with the same as the one we want
for (cmSourceGroup const& srcGroup : this->SourceGroups) {
std::string sgName = srcGroup.GetName();
std::string const& sgName = srcGroup.GetName();
if (sgName == name[0]) {
sg = const_cast<cmSourceGroup*>(&srcGroup);
break;
......@@ -2014,7 +2014,8 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& name,
}
// build the whole source group path
for (++i; i <= lastElement; ++i) {
sg->AddChild(cmSourceGroup(name[i].c_str(), nullptr, sg->GetFullName()));
sg->AddChild(
cmSourceGroup(name[i].c_str(), nullptr, sg->GetFullName().c_str()));
sg = sg->LookupChild(name[i].c_str());
}
......
......@@ -60,14 +60,14 @@ void cmSourceGroup::AddGroupFile(const std::string& name)
this->GroupFiles.insert(name);
}
const char* cmSourceGroup::GetName() const
std::string const& cmSourceGroup::GetName() const
{
return this->Name.c_str();
return this->Name;
}
const char* cmSourceGroup::GetFullName() const
std::string const& cmSourceGroup::GetFullName() const
{
return this->FullName.c_str();
return this->FullName;
}
bool cmSourceGroup::MatchesRegex(const char* name)
......@@ -105,7 +105,7 @@ cmSourceGroup* cmSourceGroup::LookupChild(const char* name) const
// st
for (; iter != end; ++iter) {
std::string sgName = iter->GetName();
std::string const& sgName = iter->GetName();
// look if descenened is the one were looking for
if (sgName == name) {
......
......@@ -55,12 +55,12 @@ public:
/**
* Get the name of this group.
*/
const char* GetName() const;
std::string const& GetName() const;
/**
* Get the full path name for group.
*/
const char* GetFullName() const;
std::string const& GetFullName() const;
/**
* Check if the given name matches this group's regex.
......
......@@ -1472,8 +1472,8 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
for (std::set<cmSourceGroup*>::iterator g = groupsUsed.begin();
g != groupsUsed.end(); ++g) {
cmSourceGroup* sg = *g;
const char* name = sg->GetFullName();
if (strlen(name) != 0) {
std::string const& name = sg->GetFullName();
if (!name.empty()) {
this->WriteString("<Filter Include=\"", 2);
(*this->BuildFileStream) << name << "\">\n";
std::string guidName = "SG_Filter_";
......@@ -1558,12 +1558,12 @@ void cmVisualStudio10TargetGenerator::WriteGroupSources(
std::string const& source = sf->GetFullPath();
cmSourceGroup* sourceGroup =
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
const char* filter = sourceGroup->GetFullName();
std::string const& filter = sourceGroup->GetFullName();
this->WriteString("<", 2);
std::string path = this->ConvertPath(source, s->RelativePath);
this->ConvertToWindowsSlash(path);
(*this->BuildFileStream) << name << " Include=\"" << cmVS10EscapeXML(path);
if (strlen(filter)) {
if (!filter.empty()) {
(*this->BuildFileStream) << "\">\n";
this->WriteString("<Filter>", 3);
(*this->BuildFileStream) << filter << "</Filter>\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment