Introduced alias for parser’s underlying character type.
This commit is contained in:
parent
a1b334a302
commit
f81fd1a1b4
@ -17,6 +17,9 @@ namespace utils
|
|||||||
|
|
||||||
class Parser
|
class Parser
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
using CharacterType = unsigned char;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Parser(std::istream &istream);
|
explicit Parser(std::istream &istream);
|
||||||
|
|
||||||
@ -35,18 +38,18 @@ class Parser
|
|||||||
std::string getLine();
|
std::string getLine();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const std::istream_iterator<unsigned char> EndOfFile;
|
static const std::istream_iterator<CharacterType> EndOfFile;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void checkStream() const;
|
void checkStream() const;
|
||||||
void advance();
|
void advance();
|
||||||
|
|
||||||
bool advanceIf(unsigned char expectedCharacter);
|
bool advanceIf(CharacterType expectedCharacter);
|
||||||
|
|
||||||
uint64_t parseIntegerBody();
|
uint64_t parseIntegerBody();
|
||||||
|
|
||||||
std::istream &m_istream;
|
std::istream &m_istream;
|
||||||
std::istream_iterator<unsigned char> m_position;
|
std::istream_iterator<CharacterType> m_position;
|
||||||
|
|
||||||
size_t m_row;
|
size_t m_row;
|
||||||
size_t m_column;
|
size_t m_column;
|
||||||
|
@ -17,7 +17,7 @@ namespace utils
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
const std::istream_iterator<unsigned char> Parser::EndOfFile = std::istream_iterator<unsigned char>();
|
const std::istream_iterator<Parser::CharacterType> Parser::EndOfFile = std::istream_iterator<Parser::CharacterType>();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ void Parser::advance()
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool Parser::advanceIf(unsigned char expectedCharacter)
|
bool Parser::advanceIf(CharacterType expectedCharacter)
|
||||||
{
|
{
|
||||||
checkStream();
|
checkStream();
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ uint64_t Parser::parseIntegerBody()
|
|||||||
|
|
||||||
uint64_t value = 0;
|
uint64_t value = 0;
|
||||||
|
|
||||||
while (m_position != std::istream_iterator<unsigned char>())
|
while (m_position != std::istream_iterator<CharacterType>())
|
||||||
{
|
{
|
||||||
const auto character = *m_position;
|
const auto character = *m_position;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user