mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-01-03 09:29:50 +00:00
25 lines
568 B
C
25 lines
568 B
C
|
#pragma once
|
||
|
|
||
|
#include <string>
|
||
|
|
||
|
#include "simdjson/simdjson.h"
|
||
|
|
||
|
class parser_t {
|
||
|
private:
|
||
|
// N.B.
|
||
|
// The parser must be kept for the lifetime of any parsed data.
|
||
|
// Therefore, it can only be used for one document at a time.
|
||
|
static simdjson::dom::parser m_parser;
|
||
|
|
||
|
std::string m_path;
|
||
|
simdjson::dom::element m_raw;
|
||
|
|
||
|
public:
|
||
|
parser_t(std::string path) noexcept;
|
||
|
|
||
|
[[nodiscard]] constexpr const auto& path() const noexcept { return m_path; }
|
||
|
[[nodiscard]] const auto raw() const noexcept { return m_raw; }
|
||
|
|
||
|
virtual void load();
|
||
|
};
|