migrate from dynamic::Value to dv::value & total erase namespace 'dynamic'
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "data/dynamic.hpp"
|
||||
#include "data/dv.hpp"
|
||||
|
||||
namespace cmd {
|
||||
enum class ArgType { number, integer, enumvalue, selector, string };
|
||||
@@ -31,8 +31,8 @@ namespace cmd {
|
||||
std::string name;
|
||||
ArgType type;
|
||||
bool optional;
|
||||
dynamic::Value def;
|
||||
dynamic::Value origin;
|
||||
dv::value def;
|
||||
dv::value origin;
|
||||
std::string enumname;
|
||||
};
|
||||
|
||||
@@ -41,12 +41,12 @@ namespace cmd {
|
||||
|
||||
struct Prompt {
|
||||
Command* command;
|
||||
dynamic::List_sptr args; // positional arguments list
|
||||
dynamic::Map_sptr kwargs; // keyword arguments table
|
||||
dv::value args; // positional arguments list
|
||||
dv::value kwargs; // keyword arguments table
|
||||
};
|
||||
|
||||
using executor_func = std::function<dynamic::Value(
|
||||
CommandsInterpreter*, dynamic::List_sptr args, dynamic::Map_sptr kwargs
|
||||
using executor_func = std::function<dv::value(
|
||||
CommandsInterpreter*, dv::value args, dv::value kwargs
|
||||
)>;
|
||||
|
||||
class Command {
|
||||
@@ -85,7 +85,7 @@ namespace cmd {
|
||||
return &found->second;
|
||||
}
|
||||
|
||||
dynamic::Value execute(
|
||||
dv::value execute(
|
||||
CommandsInterpreter* interpreter, const Prompt& prompt
|
||||
) {
|
||||
return executor(interpreter, prompt.args, prompt.kwargs);
|
||||
@@ -127,7 +127,7 @@ namespace cmd {
|
||||
|
||||
class CommandsInterpreter {
|
||||
std::unique_ptr<CommandsRepository> repository;
|
||||
std::unordered_map<std::string, dynamic::Value> variables;
|
||||
std::unordered_map<std::string, dv::value> variables;
|
||||
public:
|
||||
CommandsInterpreter()
|
||||
: repository(std::make_unique<CommandsRepository>()) {
|
||||
@@ -141,15 +141,15 @@ namespace cmd {
|
||||
|
||||
Prompt parse(std::string_view text);
|
||||
|
||||
dynamic::Value execute(std::string_view input) {
|
||||
dv::value execute(std::string_view input) {
|
||||
return execute(parse(input));
|
||||
}
|
||||
|
||||
dynamic::Value execute(const Prompt& prompt) {
|
||||
dv::value execute(const Prompt& prompt) {
|
||||
return prompt.command->execute(this, prompt);
|
||||
}
|
||||
|
||||
dynamic::Value& operator[](const std::string& name) {
|
||||
dv::value& operator[](const std::string& name) {
|
||||
return variables[name];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user