Skip to content

Instantly share code, notes, and snippets.

@neugen86
Created October 21, 2019 08:35
Show Gist options
  • Save neugen86/2dfb7431aa59ba3ab020476c4b0abd65 to your computer and use it in GitHub Desktop.
Save neugen86/2dfb7431aa59ba3ab020476c4b0abd65 to your computer and use it in GitHub Desktop.
class MainCommand;
class MainSucceededCommand;
class MainFailedCommand;
class MyControllerWithStartMethod
{
public:
void start()
{
CommandBuilder<MainCommand> builder;
builder.onSucceeded([this]{ onFistSucceeded(); });
builder.onFailed([this]{ onFirstFailed(); });
Command cmd = builder.build();
cmd.execute();
}
private:
void onFirstSucceded()
{
CommandBuilder<MainSucceededCommand> builder;
builder.onSucceeded([]
{
});
builder.onFailed({
});
Command cmd = builder.build();
cmd.execute();
}
void onFirstFailed()
{
CommandBuilder<MainFailedCommand> builder;
builder.onSucceeded([]
{
});
builder.onFailed({
});
Command cmd = builder.build();
cmd.execute();
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment