diff options
author | Brad King <brad.king@kitware.com> | 2017-11-15 15:32:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-11-15 15:47:07 (GMT) |
commit | c871446abc9f9f33bd302ed059037d719eb9e2d9 (patch) | |
tree | 7189bca12aad188ed10b739f1c98607891bf7266 /Source | |
parent | 1fe9e49bad0ad4f540ceda028106d9af89084946 (diff) | |
download | CMake-c871446abc9f9f33bd302ed059037d719eb9e2d9.zip CMake-c871446abc9f9f33bd302ed059037d719eb9e2d9.tar.gz CMake-c871446abc9f9f33bd302ed059037d719eb9e2d9.tar.bz2 |
cmSourceGroup: Return strings from GetName and GetFullName
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGhsMultiTargetGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 5 | ||||
-rw-r--r-- | Source/cmSourceGroup.cxx | 10 | ||||
-rw-r--r-- | Source/cmSourceGroup.h | 4 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 8 |
7 files changed, 19 insertions, 18 deletions
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index a31e415..b3e3393 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -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(); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index dfc1bed..41fe5d2 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -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 : diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index beb80f2..f01ed7a 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -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(), ""); } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 4109b90..5a11a90 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -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()); } diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx index fba4c31..18bcb49 100644 --- a/Source/cmSourceGroup.cxx +++ b/Source/cmSourceGroup.cxx @@ -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) { diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h index e8bd697..7c7c35f 100644 --- a/Source/cmSourceGroup.h +++ b/Source/cmSourceGroup.h @@ -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. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 6486c8b..b2ac932 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -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"; |