2016-09-27 22:01:08 +03:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2013-01-08 17:10:42 +04:00
|
|
|
#ifndef cmVisualStudioSlnParser_h
|
|
|
|
#define cmVisualStudioSlnParser_h
|
|
|
|
|
2016-09-01 21:05:48 +03:00
|
|
|
#include <cmConfigure.h>
|
|
|
|
|
2013-01-08 17:10:42 +04:00
|
|
|
#include "cmStandardIncludes.h"
|
|
|
|
|
|
|
|
#include <bitset>
|
|
|
|
|
|
|
|
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
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::bitset<DataGroupCount> DataGroupSet;
|
|
|
|
|
|
|
|
static const DataGroupSet DataGroupProjects;
|
|
|
|
static const DataGroupSet DataGroupProjectDependencies;
|
|
|
|
static const DataGroupSet DataGroupSolutionConfigurations;
|
|
|
|
static const DataGroupSet DataGroupProjectConfigurations;
|
|
|
|
static const DataGroupSet DataGroupSolutionFilters;
|
|
|
|
static const DataGroupSet DataGroupGenericGlobalSections;
|
|
|
|
static const DataGroupSet DataGroupAll;
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
bool Parse(std::istream& input, cmSlnData& output,
|
2013-01-08 17:10:42 +04:00
|
|
|
DataGroupSet dataGroups = DataGroupAll);
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
bool ParseFile(const std::string& file, cmSlnData& output,
|
2013-01-08 17:10:42 +04:00
|
|
|
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;
|
|
|
|
size_t ResultLine;
|
|
|
|
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);
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
bool ParseMultiValueTag(const std::string& line, ParsedLine& parsedLine,
|
2013-01-08 17:10:42 +04:00
|
|
|
State& state);
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
bool ParseSingleValueTag(const std::string& line, ParsedLine& parsedLine,
|
2013-01-08 17:10:42 +04:00
|
|
|
State& state);
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
bool ParseKeyValuePair(const std::string& line, ParsedLine& parsedLine,
|
2013-01-08 17:10:42 +04:00
|
|
|
State& state);
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
bool ParseTag(const std::string& fullTag, ParsedLine& parsedLine,
|
2013-01-08 17:10:42 +04:00
|
|
|
State& state);
|
|
|
|
|
|
|
|
bool ParseValue(const std::string& value, ParsedLine& parsedLine);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|