Make the FSM_STATE work better with optional loggins set by a define and standardize on using enum class by default.
This commit is contained in:
parent
8df6898d0b
commit
0aeb5b4ceb
8 changed files with 49 additions and 42 deletions
22
builder.cpp
22
builder.cpp
|
@ -88,7 +88,7 @@ void Builder::building(BuildEvent ev) {
|
|||
|
||||
build_out = NULL;
|
||||
game.event(GameEvent::BUILD_DONE);
|
||||
state(DONE);
|
||||
state(BuildState::DONE);
|
||||
} else {
|
||||
auto m = parse_line(line);
|
||||
|
||||
|
@ -96,7 +96,7 @@ void Builder::building(BuildEvent ev) {
|
|||
gui.output(format("HIT WITH {} @ {}:{}:{} {}", m.type, m.file_name, m.lnumber, m.col, m.message));
|
||||
game.event(GameEvent::HIT, m.type);
|
||||
}
|
||||
state(READING);
|
||||
state(BuildState::READING);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ void Builder::start(BuildEvent ev) {
|
|||
wid = fileWatcher->addWatch(git_path, listener, true);
|
||||
fileWatcher->watch();
|
||||
|
||||
state(WAITING);
|
||||
state(BuildState::WAITING);
|
||||
}
|
||||
|
||||
void Builder::waiting(BuildEvent ev) {
|
||||
|
@ -125,7 +125,7 @@ void Builder::waiting(BuildEvent ev) {
|
|||
game.event(GameEvent::BUILD_START);
|
||||
gui.building();
|
||||
gui.output(format("CHANGES! Running build {}", build_cmd));
|
||||
state(FORKING);
|
||||
state(BuildState::FORKING);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,16 +135,16 @@ void Builder::forking(BuildEvent ev) {
|
|||
|
||||
if(status == std::future_status::ready) {
|
||||
build_out = build_fut.get();
|
||||
state(READING);
|
||||
state(BuildState::READING);
|
||||
} else {
|
||||
state(FORKING);
|
||||
state(BuildState::FORKING);
|
||||
}
|
||||
} else {
|
||||
build_fut = std::async([&]() {
|
||||
return start_command(build_cmd);
|
||||
});
|
||||
|
||||
state(FORKING);
|
||||
state(BuildState::FORKING);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,9 +155,9 @@ void Builder::reading(BuildEvent ev) {
|
|||
|
||||
if(status == std::future_status::ready) {
|
||||
line = read_fut.get();
|
||||
state(BUILDING);
|
||||
state(BuildState::BUILDING);
|
||||
} else {
|
||||
state(READING);
|
||||
state(BuildState::READING);
|
||||
}
|
||||
} else {
|
||||
read_fut = std::async([&]() {
|
||||
|
@ -173,14 +173,14 @@ void Builder::done(BuildEvent ev) {
|
|||
|
||||
listener->reset_state();
|
||||
gui.output("^^^^^^^^^^^ END ^^^^^^^^^^^");
|
||||
state(WAITING);
|
||||
state(BuildState::WAITING);
|
||||
}
|
||||
|
||||
void Builder::exit(BuildEvent ev) {
|
||||
if(ev == QUIT) {
|
||||
fileWatcher->removeWatch(wid);
|
||||
git_libgit2_shutdown();
|
||||
state(EXIT);
|
||||
state(BuildState::EXIT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue