mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-14 16:57:58 -05:00
Extract commonly used Parser code to new Parser component
This commit is contained in:
39
src/Parser/Parsing/IParserLineStream.h
Normal file
39
src/Parser/Parsing/IParserLineStream.h
Normal file
@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <functional>
|
||||
|
||||
#include "Utils/ClassUtils.h"
|
||||
|
||||
class ParserLine
|
||||
{
|
||||
static const std::string EMPTY_STRING;
|
||||
|
||||
public:
|
||||
std::reference_wrapper<const std::string> m_filename;
|
||||
int m_line_number;
|
||||
std::string m_line;
|
||||
|
||||
ParserLine();
|
||||
ParserLine(const std::string& filename, int lineNumber, std::string line);
|
||||
|
||||
_NODISCARD bool IsEof() const;
|
||||
};
|
||||
|
||||
class IParserLineStream
|
||||
{
|
||||
public:
|
||||
IParserLineStream() = default;
|
||||
virtual ~IParserLineStream() = default;
|
||||
|
||||
IParserLineStream(const IParserLineStream& other) = default;
|
||||
IParserLineStream(IParserLineStream&& other) noexcept = default;
|
||||
IParserLineStream& operator=(const IParserLineStream& other) = default;
|
||||
IParserLineStream& operator=(IParserLineStream&& other) noexcept = default;
|
||||
|
||||
virtual ParserLine NextLine() = 0;
|
||||
virtual bool IncludeFile(const std::string& filename) = 0;
|
||||
virtual void PopCurrentFile() = 0;
|
||||
_NODISCARD virtual bool IsOpen() const = 0;
|
||||
_NODISCARD virtual bool Eof() const = 0;
|
||||
};
|
Reference in New Issue
Block a user