summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudioSlnParser.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-07-27 16:23:22 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-07-27 23:10:39 (GMT)
commit3f1378fbcab72a849908bbc988254f392d04c41a (patch)
tree0dcf9d2e38272b101fa4bfb12133a22c9fb2def7 /Source/cmVisualStudioSlnParser.cxx
parent7e3b9af191b1ae596b228d8ac3d709eecf8d82d4 (diff)
downloadCMake-3f1378fbcab72a849908bbc988254f392d04c41a.zip
CMake-3f1378fbcab72a849908bbc988254f392d04c41a.tar.gz
CMake-3f1378fbcab72a849908bbc988254f392d04c41a.tar.bz2
strings: compare to static `string_view` instances in Windows-only code
Diffstat (limited to 'Source/cmVisualStudioSlnParser.cxx')
-rw-r--r--Source/cmVisualStudioSlnParser.cxx46
1 files changed, 24 insertions, 22 deletions
diff --git a/Source/cmVisualStudioSlnParser.cxx b/Source/cmVisualStudioSlnParser.cxx
index 71c758e..76791a6 100644
--- a/Source/cmVisualStudioSlnParser.cxx
+++ b/Source/cmVisualStudioSlnParser.cxx
@@ -8,6 +8,8 @@
#include <utility>
#include <vector>
+#include <cmext/string_view>
+
#include "cmsys/FStream.hxx"
#include "cmStringAlgorithms.h"
@@ -206,7 +208,7 @@ bool cmVisualStudioSlnParser::State::Process(
this->Stack.push(FileStateTopLevel);
break;
case FileStateTopLevel:
- if (line.GetTag() == "Project") {
+ if (line.GetTag() == "Project"_s) {
if (line.GetValueCount() != 3) {
result.SetError(ResultErrorInputStructure, this->GetCurrentLine());
return false;
@@ -221,12 +223,12 @@ bool cmVisualStudioSlnParser::State::Process(
} else {
this->IgnoreUntilTag("EndProject");
}
- } else if (line.GetTag() == "Global") {
+ } else if (line.GetTag() == "Global"_s) {
this->Stack.push(FileStateGlobal);
- } else if (line.GetTag() == "VisualStudioVersion") {
+ } else if (line.GetTag() == "VisualStudioVersion"_s) {
output.SetVisualStudioVersion(line.GetValue(0));
- } else if (line.GetTag() == "MinimumVisualStudioVersion") {
+ } else if (line.GetTag() == "MinimumVisualStudioVersion"_s) {
output.SetMinimumVisualStudioVersion(line.GetValue(0));
} else {
result.SetError(ResultErrorInputStructure, this->GetCurrentLine());
@@ -234,11 +236,11 @@ bool cmVisualStudioSlnParser::State::Process(
}
break;
case FileStateProject:
- if (line.GetTag() == "EndProject") {
+ if (line.GetTag() == "EndProject"_s) {
this->Stack.pop();
- } else if (line.GetTag() == "ProjectSection") {
- if (line.GetArg() == "ProjectDependencies" &&
- line.GetValue(0) == "postProject") {
+ } else if (line.GetTag() == "ProjectSection"_s) {
+ if (line.GetArg() == "ProjectDependencies"_s &&
+ line.GetValue(0) == "postProject"_s) {
if (this->RequestedData.test(DataGroupProjectDependenciesBit)) {
this->Stack.push(FileStateProjectDependencies);
} else {
@@ -253,7 +255,7 @@ bool cmVisualStudioSlnParser::State::Process(
}
break;
case FileStateProjectDependencies:
- if (line.GetTag() == "EndProjectSection") {
+ if (line.GetTag() == "EndProjectSection"_s) {
this->Stack.pop();
} else if (line.IsKeyValuePair()) {
// implement dependency storing here, once needed
@@ -264,25 +266,25 @@ bool cmVisualStudioSlnParser::State::Process(
}
break;
case FileStateGlobal:
- if (line.GetTag() == "EndGlobal") {
+ if (line.GetTag() == "EndGlobal"_s) {
this->Stack.pop();
- } else if (line.GetTag() == "GlobalSection") {
- if (line.GetArg() == "SolutionConfigurationPlatforms" &&
- line.GetValue(0) == "preSolution") {
+ } else if (line.GetTag() == "GlobalSection"_s) {
+ if (line.GetArg() == "SolutionConfigurationPlatforms"_s &&
+ line.GetValue(0) == "preSolution"_s) {
if (this->RequestedData.test(DataGroupSolutionConfigurationsBit)) {
this->Stack.push(FileStateSolutionConfigurations);
} else {
this->IgnoreUntilTag("EndGlobalSection");
}
- } else if (line.GetArg() == "ProjectConfigurationPlatforms" &&
- line.GetValue(0) == "postSolution") {
+ } else if (line.GetArg() == "ProjectConfigurationPlatforms"_s &&
+ line.GetValue(0) == "postSolution"_s) {
if (this->RequestedData.test(DataGroupProjectConfigurationsBit)) {
this->Stack.push(FileStateProjectConfigurations);
} else {
this->IgnoreUntilTag("EndGlobalSection");
}
- } else if (line.GetArg() == "NestedProjects" &&
- line.GetValue(0) == "preSolution") {
+ } else if (line.GetArg() == "NestedProjects"_s &&
+ line.GetValue(0) == "preSolution"_s) {
if (this->RequestedData.test(DataGroupSolutionFiltersBit)) {
this->Stack.push(FileStateSolutionFilters);
} else {
@@ -300,7 +302,7 @@ bool cmVisualStudioSlnParser::State::Process(
}
break;
case FileStateSolutionConfigurations:
- if (line.GetTag() == "EndGlobalSection") {
+ if (line.GetTag() == "EndGlobalSection"_s) {
this->Stack.pop();
} else if (line.IsKeyValuePair()) {
output.AddConfiguration(line.GetValue(0));
@@ -310,7 +312,7 @@ bool cmVisualStudioSlnParser::State::Process(
}
break;
case FileStateProjectConfigurations:
- if (line.GetTag() == "EndGlobalSection") {
+ if (line.GetTag() == "EndGlobalSection"_s) {
this->Stack.pop();
} else if (line.IsKeyValuePair()) {
std::vector<std::string> tagElements =
@@ -331,7 +333,7 @@ bool cmVisualStudioSlnParser::State::Process(
return false;
}
- if (activeBuild == "ActiveCfg") {
+ if (activeBuild == "ActiveCfg"_s) {
projectEntry->AddProjectConfiguration(solutionConfiguration,
line.GetValue(0));
}
@@ -341,7 +343,7 @@ bool cmVisualStudioSlnParser::State::Process(
}
break;
case FileStateSolutionFilters:
- if (line.GetTag() == "EndGlobalSection") {
+ if (line.GetTag() == "EndGlobalSection"_s) {
this->Stack.pop();
} else if (line.IsKeyValuePair()) {
// implement filter storing here, once needed
@@ -352,7 +354,7 @@ bool cmVisualStudioSlnParser::State::Process(
}
break;
case FileStateGlobalSection:
- if (line.GetTag() == "EndGlobalSection") {
+ if (line.GetTag() == "EndGlobalSection"_s) {
this->Stack.pop();
} else if (line.IsKeyValuePair()) {
// implement section storing here, once needed