aboutsummaryrefslogtreecommitdiff
path: root/include/cru/base/toml/TomlParser.h
blob: 8d62f8dc678eb8d153ca92489f68959ee9f050bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once

#include "../Base.h"
#include "TomlDocument.h"

#include <optional>

namespace cru::toml {
// A very simple and tolerant TOML parser.
class CRU_BASE_API TomlParsingException : public Exception {
 public:
  using Exception::Exception;
};

class CRU_BASE_API TomlParser : public Object {
 public:
  explicit TomlParser(std::string input);
  ~TomlParser();

 public:
  TomlDocument Parse();

 private:
  // The document is empty to begin with.
  void DoParse(TomlDocument& document);

 private:
  std::string input_;

  std::optional<TomlDocument> cache_;
};
}  // namespace cru::toml