CAPIO-CL 2.0.1
CAPIO-CL: Cross Application Programmable I/O - Coordination Language
Loading...
Searching...
No Matches
parser.h
1#ifndef CAPIO_CL_PARSER_H
2#define CAPIO_CL_PARSER_H
3#include <jsoncons/basic_json.hpp>
4#include <jsoncons_ext/jsonschema/jsonschema.hpp>
5
7namespace capiocl::parser {
8
12class ParserException final : public std::exception {
13 std::string message;
14
15 public:
20 explicit ParserException(const std::string &msg);
21
26 [[nodiscard]] const char *what() const noexcept override { return message.c_str(); }
27};
28
30class Parser final {
31
33 struct available_parsers {
44 static engine::Engine *parse_v1(const std::filesystem::path &source,
45 const std::filesystem::path &resolve_prefix,
46 bool store_only_in_memory,
48
59 static engine::Engine *parse_v1_1(const std::filesystem::path &source,
60 const std::filesystem::path &resolve_prefix,
61 bool store_only_in_memory,
63 };
64
70 static jsoncons::jsonschema::json_schema<jsoncons::json> loadSchema(const char *data);
71
72 protected:
79 static std::filesystem::path resolve(std::filesystem::path path,
80 const std::filesystem::path &prefix);
81
82 public:
85
91 static void validate_json(const jsoncons::json &doc, const char *str_schema);
92};
93} // namespace capiocl::parser
94
95#endif // CAPIO_CL_PARSER_H
Load configuration and store it from a CAPIO-CL TOML configuration file.
Definition configuration.h:41
Engine for managing CAPIO-CL configuration entries. The CapioCLEngine class stores and manages config...
Definition engine.h:83
ParserException(const std::string &msg)
Construct a new CAPIO-CL Exception.
Definition Parser.cpp:10
const char * what() const noexcept override
Definition parser.h:26
Contains the code to parse a JSON based CAPIO-CL configuration file.
Definition parser.h:30
static std::filesystem::path resolve(std::filesystem::path path, const std::filesystem::path &prefix)
Definition Parser.cpp:22
static engine::Engine * parse(const configuration::CapioClConfiguration &config)
Definition Parser.cpp:56
static void validate_json(const jsoncons::json &doc, const char *str_schema)
Definition Parser.cpp:41
Namespace containing the CAPIO-CL parsers components.
Definition parser.h:7