-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
94 additions
and
17 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) 2022-2024 r3w0p | ||
// The following code can be redistributed and/or | ||
// modified under the terms of the GPL-3.0 License. | ||
|
||
#ifndef CARAVAN_MODEL_H | ||
#define CARAVAN_MODEL_H | ||
|
||
#include <string> | ||
#include "caravan/core/common.h" | ||
|
||
class ModelSubscriber { | ||
public: | ||
virtual void on_model_change_me() = 0; | ||
}; | ||
|
||
class Model : public Publisher<ModelSubscriber> { | ||
protected: | ||
bool closed; | ||
public: | ||
virtual ~Model() = default; | ||
explicit Model() : closed(false) {}; | ||
|
||
virtual void run() = 0; | ||
void subscribe(ModelSubscriber *sub) override; | ||
void close() { closed = true; }; | ||
}; | ||
|
||
|
||
|
||
#endif //CARAVAN_MODEL_H |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2022-2024 r3w0p | ||
// The following code can be redistributed and/or | ||
// modified under the terms of the GPL-3.0 License. | ||
|
||
#ifndef CARAVAN_MODEL_TUI_H | ||
#define CARAVAN_MODEL_TUI_H | ||
|
||
#include "caravan/model/model.h" | ||
#include "caravan/core/common.h" | ||
|
||
class ModelTUI : public Model { | ||
public: | ||
explicit ModelTUI() : Model() {}; | ||
|
||
void run() override; | ||
}; | ||
|
||
#endif //CARAVAN_MODEL_TUI_H |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) 2022-2024 r3w0p | ||
// The following code can be redistributed and/or | ||
// modified under the terms of the GPL-3.0 License. | ||
|
||
#include "caravan/model/model.h" | ||
|
||
void Model::subscribe(ModelSubscriber *sub) { | ||
subscribers.push_back(sub); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright (c) 2022-2024 r3w0p | ||
// The following code can be redistributed and/or | ||
// modified under the terms of the GPL-3.0 License. | ||
|
||
#include "caravan/model/model_tui.h" |
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