namespace blank {
-class Application;
+class HeadlessApplication;
class State;
class StateControl {
public:
+ // add state to the front
void Push(State *s) {
cue.emplace(PUSH, s);
}
+ // swap state at the front
void Switch(State *s) {
cue.emplace(SWITCH, s);
}
+ // remove state at the front
void Pop() {
cue.emplace(POP);
}
+ // remove all states
+ // application will exit if nothing is pushed after this
void PopAll() {
cue.emplace(POP_ALL);
}
+ // pop states until this one is on top
+ void PopAfter(State *s) {
+ cue.emplace(POP_AFTER, s);
+ }
+
+ // pop states until this one is removed
+ void PopUntil(State *s) {
+ cue.emplace(POP_UNTIL, s);
+ }
+
- void Commit(Application &);
+ void Commit(HeadlessApplication &);
private:
enum Command {
SWITCH,
POP,
POP_ALL,
+ POP_AFTER,
+ POP_UNTIL,
};
struct Memo {
State *state;