Created
June 23, 2020 18:28
-
-
Save sakex/205e7bd6f648acb322b046fa6518997f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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