summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/Screen.h
diff options
context:
space:
mode:
authorJoaquim <joaquim.org@gmail.com>2021-02-24 19:40:24 (GMT)
committerJoaquim <joaquim.org@gmail.com>2021-02-24 19:40:24 (GMT)
commit8c53d0b70baa03c2b07360444a7cd0ad99bb8381 (patch)
tree52585926f2abc810b2b93475dfb2580e6ea19f85 /src/displayapp/screens/Screen.h
parentc18f4e5811dbd388e3b4acc29b1fab68279ec405 (diff)
Multi face support, analog clock, 12/24 config
Diffstat (limited to 'src/displayapp/screens/Screen.h')
-rw-r--r--src/displayapp/screens/Screen.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/displayapp/screens/Screen.h b/src/displayapp/screens/Screen.h
index 6b1d0ee..638dac9 100644
--- a/src/displayapp/screens/Screen.h
+++ b/src/displayapp/screens/Screen.h
@@ -7,6 +7,26 @@ namespace Pinetime {
namespace Applications {
class DisplayApp;
namespace Screens {
+
+ template <class T>
+ class DirtyValue {
+ public:
+ DirtyValue() = default; // Use NSDMI
+ explicit DirtyValue(T const& v):value{v}{} // Use MIL and const-lvalue-ref
+ bool IsUpdated() const { return isUpdated; }
+ T const& Get() { this->isUpdated = false; return value; } // never expose a non-const lvalue-ref
+ DirtyValue& operator=(const T& other) {
+ if (this->value != other) {
+ this->value = other;
+ this->isUpdated = true;
+ }
+ return *this;
+ }
+ private:
+ T value{}; // NSDMI - default initialise type
+ bool isUpdated{true}; // NSDMI - use brace initilisation
+ };
+
class Screen {
public:
explicit Screen(DisplayApp* app) : app{app} {}