blob: bd90a604000878b1c74e8a3805ef540ce11111f5 [file] [log] [blame]
Václav Kubernát96344a12018-05-28 16:33:39 +02001/*
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át6415b822018-08-22 17:40:01 +020012#include "datastore_access.hpp"
Václav Kubernát812ee282018-08-30 17:10:03 +020013#include "parser.hpp"
Václav Kubernát96344a12018-05-28 16:33:39 +020014
15struct Interpreter : boost::static_visitor<void> {
Václav Kubernát6415b822018-08-22 17:40:01 +020016 Interpreter(Parser& parser, DatastoreAccess& datastore);
Václav Kubernát96344a12018-05-28 16:33:39 +020017
Václav Kubernát812ee282018-08-30 17:10:03 +020018 void operator()(const commit_&) const;
Václav Kubernát07204242018-06-04 18:12:09 +020019 void operator()(const set_&) const;
Václav Kubernátb6ff0b62018-08-30 16:14:53 +020020 void operator()(const get_&) const;
Václav Kubernát96344a12018-05-28 16:33:39 +020021 void operator()(const cd_&) const;
Václav Kubernátb61336d2018-05-28 17:35:03 +020022 void operator()(const create_&) const;
23 void operator()(const delete_&) const;
Václav Kubernát11afac72018-07-18 14:59:53 +020024 void operator()(const ls_&) const;
Václav Kubernát9cfcd872020-02-18 12:34:02 +010025 void operator()(const describe_&) const;
Václav Kubernát6d791432018-10-25 16:00:35 +020026 void operator()(const discard_&) const;
Václav Kubernát054cc992019-02-21 14:23:52 +010027 void operator()(const help_&) const;
Václav Kubernát7160a132020-04-03 02:11:01 +020028 void operator()(const copy_& copy) const;
Václav Kubernátbf65dd72020-05-28 02:32:31 +020029 void operator()(const move_& move) const;
Václav Kubernátb61336d2018-05-28 17:35:03 +020030
Václav Kubernát96344a12018-05-28 16:33:39 +020031private:
Václav Kubernát6415b822018-08-22 17:40:01 +020032 template <typename T>
33 std::string absolutePathFromCommand(const T& command) const;
Václav Kubernátb6ff0b62018-08-30 16:14:53 +020034 std::string absolutePathFromCommand(const get_& command) const;
Václav Kubernát9cfcd872020-02-18 12:34:02 +010035 std::string absolutePathFromCommand(const describe_& describe) const;
36 std::string buildTypeInfo(const std::string& path) const;
Václav Kubernát6415b822018-08-22 17:40:01 +020037
Václav Kubernát96344a12018-05-28 16:33:39 +020038 Parser& m_parser;
Václav Kubernát6415b822018-08-22 17:40:01 +020039 DatastoreAccess& m_datastore;
Václav Kubernát96344a12018-05-28 16:33:39 +020040};