blob: fd14ffebedd9ac87f035c24263c7e1cd091bc72a [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át96344a12018-05-28 16:33:39 +020020 void operator()(const cd_&) const;
Václav Kubernátb61336d2018-05-28 17:35:03 +020021 void operator()(const create_&) const;
22 void operator()(const delete_&) const;
Václav Kubernát11afac72018-07-18 14:59:53 +020023 void operator()(const ls_&) const;
Václav Kubernátb61336d2018-05-28 17:35:03 +020024
Václav Kubernát96344a12018-05-28 16:33:39 +020025private:
Václav Kubernát6415b822018-08-22 17:40:01 +020026 template <typename T>
27 std::string absolutePathFromCommand(const T& command) const;
28
Václav Kubernát96344a12018-05-28 16:33:39 +020029 Parser& m_parser;
Václav Kubernát6415b822018-08-22 17:40:01 +020030 DatastoreAccess& m_datastore;
Václav Kubernát96344a12018-05-28 16:33:39 +020031};