Михаил Капелько 6 months ago
parent
commit
15c4c62b11
2 changed files with 12 additions and 7 deletions
  1. +10
    -4
      v4/ctx.h
  2. +2
    -3
      v4/main.cpp

+ 10
- 4
v4/ctx.h View File

@@ -45,10 +45,6 @@ template <class T> class ctx_Controller {
isProcessingQueue = false; isProcessingQueue = false;
} }


void registerFunction(std::function<T(T)> f) {
functions.push_back(f);
}

void registerCallback(std::function<void(T)> cb) { void registerCallback(std::function<void(T)> cb) {
callbacks.push_back(cb); callbacks.push_back(cb);
} }
@@ -65,6 +61,16 @@ template <class T> class ctx_Controller {
callbacks.push_back(execCB); callbacks.push_back(execCB);
} }


void registerFunction(std::function<T(T)> f) {
functions.push_back(f);
}

void registerFunctions(std::list<std::function<T(T)> > funcs) {
for (const auto &f : funcs) {
functions.push_back(f);
}
}

void reportContext() { void reportContext() {
for (const auto &cb : callbacks) { for (const auto &cb : callbacks) {
cb(context); cb(context);


+ 2
- 3
v4/main.cpp View File

@@ -81,8 +81,6 @@ int main() {
ctrl.registerFunctions({ ctrl.registerFunctions({
cli_exit, cli_exit,
cli_goOn, cli_goOn,
});
/*
cli_greetUser, cli_greetUser,
cli_promptSecondItemSelection, cli_promptSecondItemSelection,
cli_reportMatchedItems, cli_reportMatchedItems,
@@ -95,7 +93,8 @@ int main() {
memory_generateConstPlayfield, memory_generateConstPlayfield,
memory_hideMatchingItems, memory_hideMatchingItems,
memory_selectItem, memory_selectItem,
])
});
/*


auto c = shell_createContext(); auto c = shell_createContext();
c.cCLI = cli_createContext(); c.cCLI = cli_createContext();


Loading…
Cancel
Save