mirror of
https://github.com/Kitware/CMake.git
synced 2025-05-09 23:08:18 +08:00

Run the `clang-format.bash` script to update all our C and C++ code to a new style defined by `.clang-format`, now with "east const" enforcement. Use `clang-format` version 18. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit. Issue: #26123
104 lines
2.7 KiB
C++
104 lines
2.7 KiB
C++
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
|
#pragma once
|
|
|
|
#include "cmConfigure.h" // IWYU pragma: keep
|
|
|
|
#include <bitset>
|
|
#include <cstddef>
|
|
#include <iosfwd>
|
|
#include <string>
|
|
|
|
#include <cm/string_view>
|
|
|
|
class cmSlnData;
|
|
|
|
class cmVisualStudioSlnParser
|
|
{
|
|
public:
|
|
enum ParseResult
|
|
{
|
|
ResultOK = 0,
|
|
|
|
ResultInternalError = -1,
|
|
ResultExternalError = 1,
|
|
|
|
ResultErrorOpeningInput = ResultExternalError,
|
|
ResultErrorReadingInput,
|
|
ResultErrorInputStructure,
|
|
ResultErrorInputData,
|
|
|
|
ResultErrorBadInternalState = ResultInternalError,
|
|
ResultErrorUnsupportedDataGroup = ResultInternalError - 1
|
|
};
|
|
|
|
enum DataGroup
|
|
{
|
|
DataGroupProjectsBit,
|
|
DataGroupProjectDependenciesBit,
|
|
DataGroupSolutionConfigurationsBit,
|
|
DataGroupProjectConfigurationsBit,
|
|
DataGroupSolutionFiltersBit,
|
|
DataGroupGenericGlobalSectionsBit,
|
|
DataGroupCount
|
|
};
|
|
|
|
using DataGroupSet = std::bitset<DataGroupCount>;
|
|
|
|
static DataGroupSet const DataGroupProjects;
|
|
static DataGroupSet const DataGroupProjectDependencies;
|
|
static DataGroupSet const DataGroupSolutionConfigurations;
|
|
static DataGroupSet const DataGroupProjectConfigurations;
|
|
static DataGroupSet const DataGroupSolutionFilters;
|
|
static DataGroupSet const DataGroupGenericGlobalSections;
|
|
static DataGroupSet const DataGroupAll;
|
|
|
|
bool Parse(std::istream& input, cmSlnData& output,
|
|
DataGroupSet dataGroups = DataGroupAll);
|
|
|
|
bool ParseFile(std::string const& file, cmSlnData& output,
|
|
DataGroupSet dataGroups = DataGroupAll);
|
|
|
|
ParseResult GetParseResult() const;
|
|
|
|
size_t GetParseResultLine() const;
|
|
|
|
bool GetParseHadBOM() const;
|
|
|
|
protected:
|
|
class State;
|
|
|
|
friend class State;
|
|
class ParsedLine;
|
|
|
|
struct ResultData
|
|
{
|
|
ParseResult Result = ResultOK;
|
|
size_t ResultLine = 0;
|
|
bool HadBOM;
|
|
|
|
ResultData();
|
|
void Clear();
|
|
void SetError(ParseResult error, size_t line);
|
|
} LastResult;
|
|
|
|
bool IsDataGroupSetSupported(DataGroupSet dataGroups) const;
|
|
|
|
bool ParseImpl(std::istream& input, cmSlnData& output, State& state);
|
|
|
|
bool ParseBOM(std::istream& input, std::string& line, State& state);
|
|
|
|
bool ParseMultiValueTag(std::string const& line, ParsedLine& parsedLine,
|
|
State& state);
|
|
|
|
bool ParseSingleValueTag(std::string const& line, ParsedLine& parsedLine,
|
|
State& state);
|
|
|
|
bool ParseKeyValuePair(std::string const& line, ParsedLine& parsedLine,
|
|
State& state);
|
|
|
|
bool ParseTag(cm::string_view fullTag, ParsedLine& parsedLine, State& state);
|
|
|
|
bool ParseValue(std::string const& value, ParsedLine& parsedLine);
|
|
};
|