From 15c4c62b11133e9588a4fba21efbc5980993a453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=9A=D0=B0=D0=BF?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BA=D0=BE?= Date: Sat, 8 Jun 2024 22:09:22 +0300 Subject: [PATCH] d --- v4/ctx.h | 14 ++++++++++---- v4/main.cpp | 5 ++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/v4/ctx.h b/v4/ctx.h index 975c0aa..bd9848f 100644 --- a/v4/ctx.h +++ b/v4/ctx.h @@ -45,10 +45,6 @@ template class ctx_Controller { isProcessingQueue = false; } - void registerFunction(std::function f) { - functions.push_back(f); - } - void registerCallback(std::function cb) { callbacks.push_back(cb); } @@ -65,6 +61,16 @@ template class ctx_Controller { callbacks.push_back(execCB); } + void registerFunction(std::function f) { + functions.push_back(f); + } + + void registerFunctions(std::list > funcs) { + for (const auto &f : funcs) { + functions.push_back(f); + } + } + void reportContext() { for (const auto &cb : callbacks) { cb(context); diff --git a/v4/main.cpp b/v4/main.cpp index 8a8ec17..3ff71de 100644 --- a/v4/main.cpp +++ b/v4/main.cpp @@ -81,8 +81,6 @@ int main() { ctrl.registerFunctions({ cli_exit, cli_goOn, - }); - /* cli_greetUser, cli_promptSecondItemSelection, cli_reportMatchedItems, @@ -95,7 +93,8 @@ int main() { memory_generateConstPlayfield, memory_hideMatchingItems, memory_selectItem, - ]) + }); + /* auto c = shell_createContext(); c.cCLI = cli_createContext();