Skip to content

Instantly share code, notes, and snippets.

@sakex
Created June 23, 2020 18:28
Show Gist options
  • Save sakex/205e7bd6f648acb322b046fa6518997f to your computer and use it in GitHub Desktop.
Save sakex/205e7bd6f648acb322b046fa6518997f to your computer and use it in GitHub Desktop.
// bindings.hpp
class ButtonBindingConcrete : public AbstractButton {
public:
explicit ButtonBindingConcrete(AbstractButtonBinding *_binding): binding{_binding} {
}
// RAII free the pointer on delete
~ButtonBindingConcrete() {
delete binding;
}
void click() override {
(*binding->click)(binding->context);
}
std::string innerText() override {
char const *text = (*binding->inner_text)(binding->context);
return std::string(text);
}
private:
AbstractButtonBinding *binding;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment