mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 12:16:40 +08:00
pass cm::string_view to cmVisualStudioSlnParser::ParseTag()
This commit is contained in:
@@ -517,7 +517,7 @@ bool cmVisualStudioSlnParser::ParseMultiValueTag(const std::string& line,
|
|||||||
State& state)
|
State& state)
|
||||||
{
|
{
|
||||||
size_t idxEqualSign = line.find('=');
|
size_t idxEqualSign = line.find('=');
|
||||||
const std::string& fullTag = line.substr(0, idxEqualSign);
|
auto fullTag = cm::string_view(line).substr(0, idxEqualSign);
|
||||||
if (!this->ParseTag(fullTag, parsedLine, state))
|
if (!this->ParseTag(fullTag, parsedLine, state))
|
||||||
return false;
|
return false;
|
||||||
if (idxEqualSign != line.npos) {
|
if (idxEqualSign != line.npos) {
|
||||||
@@ -560,7 +560,7 @@ bool cmVisualStudioSlnParser::ParseSingleValueTag(const std::string& line,
|
|||||||
State& state)
|
State& state)
|
||||||
{
|
{
|
||||||
size_t idxEqualSign = line.find('=');
|
size_t idxEqualSign = line.find('=');
|
||||||
const std::string& fullTag = line.substr(0, idxEqualSign);
|
auto fullTag = cm::string_view(line).substr(0, idxEqualSign);
|
||||||
if (!this->ParseTag(fullTag, parsedLine, state))
|
if (!this->ParseTag(fullTag, parsedLine, state))
|
||||||
return false;
|
return false;
|
||||||
if (idxEqualSign != line.npos) {
|
if (idxEqualSign != line.npos) {
|
||||||
@@ -586,17 +586,17 @@ bool cmVisualStudioSlnParser::ParseKeyValuePair(const std::string& line,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmVisualStudioSlnParser::ParseTag(const std::string& fullTag,
|
bool cmVisualStudioSlnParser::ParseTag(cm::string_view fullTag,
|
||||||
ParsedLine& parsedLine, State& state)
|
ParsedLine& parsedLine, State& state)
|
||||||
{
|
{
|
||||||
size_t idxLeftParen = fullTag.find('(');
|
size_t idxLeftParen = fullTag.find('(');
|
||||||
if (idxLeftParen == fullTag.npos) {
|
if (idxLeftParen == cm::string_view::npos) {
|
||||||
parsedLine.SetTag(cmTrimWhitespace(fullTag));
|
parsedLine.SetTag(cmTrimWhitespace(fullTag));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
parsedLine.SetTag(cmTrimWhitespace(fullTag.substr(0, idxLeftParen)));
|
parsedLine.SetTag(cmTrimWhitespace(fullTag.substr(0, idxLeftParen)));
|
||||||
size_t idxRightParen = fullTag.rfind(')');
|
size_t idxRightParen = fullTag.rfind(')');
|
||||||
if (idxRightParen == fullTag.npos) {
|
if (idxRightParen == cm::string_view::npos) {
|
||||||
this->LastResult.SetError(ResultErrorInputStructure,
|
this->LastResult.SetError(ResultErrorInputStructure,
|
||||||
state.GetCurrentLine());
|
state.GetCurrentLine());
|
||||||
return false;
|
return false;
|
||||||
|
@@ -9,6 +9,8 @@
|
|||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <cm/string_view>
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
class cmSlnData;
|
class cmSlnData;
|
||||||
@@ -97,8 +99,7 @@ protected:
|
|||||||
bool ParseKeyValuePair(const std::string& line, ParsedLine& parsedLine,
|
bool ParseKeyValuePair(const std::string& line, ParsedLine& parsedLine,
|
||||||
State& state);
|
State& state);
|
||||||
|
|
||||||
bool ParseTag(const std::string& fullTag, ParsedLine& parsedLine,
|
bool ParseTag(cm::string_view fullTag, ParsedLine& parsedLine, State& state);
|
||||||
State& state);
|
|
||||||
|
|
||||||
bool ParseValue(const std::string& value, ParsedLine& parsedLine);
|
bool ParseValue(const std::string& value, ParsedLine& parsedLine);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user