You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
638 B
40 lines
638 B
2 years ago
|
#pragma once
|
||
|
|
||
|
#include <memory>
|
||
|
|
||
|
#include <cstdint>
|
||
|
|
||
|
struct Point {
|
||
|
uint64_t x,y;
|
||
|
};
|
||
|
|
||
|
struct Line {
|
||
|
Point start, end;
|
||
|
};
|
||
|
|
||
|
template<typename T>
|
||
|
using Output = T* __restrict__;
|
||
|
|
||
|
namespace Input {
|
||
|
struct Parser {
|
||
|
Parser(const char* string, size_t len) noexcept;
|
||
|
template<size_t N>
|
||
|
inline Parser(const char (&string)[N]) noexcept
|
||
|
: Parser(string, N) {}
|
||
|
|
||
|
Parser(Parser&&) noexcept;
|
||
|
Parser(const Parser&) = delete;
|
||
|
|
||
|
Parser& operator=(Parser&&) noexcept;
|
||
|
Parser& operator=(const Parser&) = delete;
|
||
|
|
||
|
bool try_read_next(Output<Line>);
|
||
|
|
||
|
virtual ~Parser();
|
||
|
private:
|
||
|
struct _impl;
|
||
|
|
||
|
std::unique_ptr<_impl> state_;
|
||
|
};
|
||
|
}
|