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 | |
| 15 | struct Interpreter : boost::static_visitor<void> { |
Václav Kubernát | 6415b82 | 2018-08-22 17:40:01 +0200 | [diff] [blame] | 16 | Interpreter(Parser& parser, DatastoreAccess& datastore); |
Václav Kubernát | 96344a1 | 2018-05-28 16:33:39 +0200 | [diff] [blame] | 17 | |
Václav Kubernát | 812ee28 | 2018-08-30 17:10:03 +0200 | [diff] [blame] | 18 | void operator()(const commit_&) const; |
Václav Kubernát | 0720424 | 2018-06-04 18:12:09 +0200 | [diff] [blame] | 19 | void operator()(const set_&) const; |
Václav Kubernát | b6ff0b6 | 2018-08-30 16:14:53 +0200 | [diff] [blame] | 20 | void operator()(const get_&) const; |
Václav Kubernát | 96344a1 | 2018-05-28 16:33:39 +0200 | [diff] [blame] | 21 | void operator()(const cd_&) const; |
Václav Kubernát | b61336d | 2018-05-28 17:35:03 +0200 | [diff] [blame] | 22 | void operator()(const create_&) const; |
| 23 | void operator()(const delete_&) const; |
Václav Kubernát | 11afac7 | 2018-07-18 14:59:53 +0200 | [diff] [blame] | 24 | void operator()(const ls_&) const; |
Václav Kubernát | 6d79143 | 2018-10-25 16:00:35 +0200 | [diff] [blame] | 25 | void operator()(const discard_&) const; |
Václav Kubernát | 054cc99 | 2019-02-21 14:23:52 +0100 | [diff] [blame] | 26 | void operator()(const help_&) const; |
Václav Kubernát | b61336d | 2018-05-28 17:35:03 +0200 | [diff] [blame] | 27 | |
Václav Kubernát | 96344a1 | 2018-05-28 16:33:39 +0200 | [diff] [blame] | 28 | private: |
Václav Kubernát | 6415b82 | 2018-08-22 17:40:01 +0200 | [diff] [blame] | 29 | template <typename T> |
| 30 | std::string absolutePathFromCommand(const T& command) const; |
Václav Kubernát | b6ff0b6 | 2018-08-30 16:14:53 +0200 | [diff] [blame] | 31 | std::string absolutePathFromCommand(const get_& command) const; |
Václav Kubernát | 6415b82 | 2018-08-22 17:40:01 +0200 | [diff] [blame] | 32 | |
Václav Kubernát | 96344a1 | 2018-05-28 16:33:39 +0200 | [diff] [blame] | 33 | Parser& m_parser; |
Václav Kubernát | 6415b82 | 2018-08-22 17:40:01 +0200 | [diff] [blame] | 34 | DatastoreAccess& m_datastore; |
Václav Kubernát | 96344a1 | 2018-05-28 16:33:39 +0200 | [diff] [blame] | 35 | }; |