Václav Kubernát | 96344a1 | 2018-05-28 16:33:39 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/ |
| 3 | * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/ |
| 4 | * |
| 5 | * Written by Václav Kubernát <kubervac@fit.cvut.cz> |
| 6 | * |
| 7 | */ |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include <boost/variant/static_visitor.hpp> |
Václav Kubernát | 6415b82 | 2018-08-22 17:40:01 +0200 | [diff] [blame] | 12 | #include "datastore_access.hpp" |
Václav Kubernát | 812ee28 | 2018-08-30 17:10:03 +0200 | [diff] [blame] | 13 | #include "parser.hpp" |
Václav Kubernát | 96344a1 | 2018-05-28 16:33:39 +0200 | [diff] [blame] | 14 | |
Václav Kubernát | 4c3d22f | 2020-06-12 16:05:01 +0200 | [diff] [blame] | 15 | |
Václav Kubernát | 96344a1 | 2018-05-28 16:33:39 +0200 | [diff] [blame] | 16 | struct Interpreter : boost::static_visitor<void> { |
Václav Kubernát | 6415b82 | 2018-08-22 17:40:01 +0200 | [diff] [blame] | 17 | Interpreter(Parser& parser, DatastoreAccess& datastore); |
Václav Kubernát | 96344a1 | 2018-05-28 16:33:39 +0200 | [diff] [blame] | 18 | |
Václav Kubernát | 812ee28 | 2018-08-30 17:10:03 +0200 | [diff] [blame] | 19 | void operator()(const commit_&) const; |
Václav Kubernát | 0720424 | 2018-06-04 18:12:09 +0200 | [diff] [blame] | 20 | void operator()(const set_&) const; |
Václav Kubernát | b6ff0b6 | 2018-08-30 16:14:53 +0200 | [diff] [blame] | 21 | void operator()(const get_&) const; |
Václav Kubernát | 96344a1 | 2018-05-28 16:33:39 +0200 | [diff] [blame] | 22 | void operator()(const cd_&) const; |
Václav Kubernát | b61336d | 2018-05-28 17:35:03 +0200 | [diff] [blame] | 23 | void operator()(const create_&) const; |
| 24 | void operator()(const delete_&) const; |
Václav Kubernát | 11afac7 | 2018-07-18 14:59:53 +0200 | [diff] [blame] | 25 | void operator()(const ls_&) const; |
Václav Kubernát | 9cfcd87 | 2020-02-18 12:34:02 +0100 | [diff] [blame] | 26 | void operator()(const describe_&) const; |
Václav Kubernát | 6d79143 | 2018-10-25 16:00:35 +0200 | [diff] [blame] | 27 | void operator()(const discard_&) const; |
Václav Kubernát | 054cc99 | 2019-02-21 14:23:52 +0100 | [diff] [blame] | 28 | void operator()(const help_&) const; |
Václav Kubernát | 7160a13 | 2020-04-03 02:11:01 +0200 | [diff] [blame] | 29 | void operator()(const copy_& copy) const; |
Václav Kubernát | bf65dd7 | 2020-05-28 02:32:31 +0200 | [diff] [blame] | 30 | void operator()(const move_& move) const; |
Václav Kubernát | 70d7f7a | 2020-06-23 14:40:40 +0200 | [diff] [blame] | 31 | void operator()(const dump_& dump) const; |
Václav Kubernát | b61336d | 2018-05-28 17:35:03 +0200 | [diff] [blame] | 32 | |
Václav Kubernát | 96344a1 | 2018-05-28 16:33:39 +0200 | [diff] [blame] | 33 | private: |
Václav Kubernát | 9cfcd87 | 2020-02-18 12:34:02 +0100 | [diff] [blame] | 34 | std::string buildTypeInfo(const std::string& path) const; |
Václav Kubernát | 6415b82 | 2018-08-22 17:40:01 +0200 | [diff] [blame] | 35 | |
Václav Kubernát | 7e16769 | 2020-06-12 09:53:01 +0200 | [diff] [blame] | 36 | template <typename PathType> |
Václav Kubernát | 4c3d22f | 2020-06-12 16:05:01 +0200 | [diff] [blame] | 37 | boost::variant<dataPath_, schemaPath_, module_> toCanonicalPath(const boost::optional<PathType>& path) const; |
Václav Kubernát | 7e16769 | 2020-06-12 09:53:01 +0200 | [diff] [blame] | 38 | |
| 39 | template <typename PathType> |
Václav Kubernát | 4c3d22f | 2020-06-12 16:05:01 +0200 | [diff] [blame] | 40 | boost::variant<dataPath_, schemaPath_, module_> toCanonicalPath(const PathType& path) const; |
Václav Kubernát | 7e16769 | 2020-06-12 09:53:01 +0200 | [diff] [blame] | 41 | |
Václav Kubernát | 96344a1 | 2018-05-28 16:33:39 +0200 | [diff] [blame] | 42 | Parser& m_parser; |
Václav Kubernát | 6415b82 | 2018-08-22 17:40:01 +0200 | [diff] [blame] | 43 | DatastoreAccess& m_datastore; |
Václav Kubernát | 96344a1 | 2018-05-28 16:33:39 +0200 | [diff] [blame] | 44 | }; |