diff options
author | louiz’ <louiz@louiz.org> | 2017-06-28 14:42:33 +0200 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2017-06-28 14:42:33 +0200 |
commit | c5407cf8ce6add6f3534df41398235e93b605ab3 (patch) | |
tree | f62cccb758dde48270cc24257df36bd3f5f89cf8 /src/utils | |
parent | 13a1ab1878fd6312aea485ded3f5bad59c36f17f (diff) | |
parent | b71ca15a0f9114db38eec23b49d1489a2ff1d0ca (diff) | |
download | biboumi-c5407cf8ce6add6f3534df41398235e93b605ab3.tar.gz biboumi-c5407cf8ce6add6f3534df41398235e93b605ab3.tar.bz2 biboumi-c5407cf8ce6add6f3534df41398235e93b605ab3.tar.xz biboumi-c5407cf8ce6add6f3534df41398235e93b605ab3.zip |
Merge branch 'master' into debian
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/optional_bool.hpp | 35 | ||||
-rw-r--r-- | src/utils/reload.cpp | 2 |
2 files changed, 36 insertions, 1 deletions
diff --git a/src/utils/optional_bool.hpp b/src/utils/optional_bool.hpp new file mode 100644 index 0000000..59bbbab --- /dev/null +++ b/src/utils/optional_bool.hpp @@ -0,0 +1,35 @@ +#pragma once + +#include <string> + +struct OptionalBool +{ + OptionalBool() = default; + + OptionalBool(bool value): + is_set(true), value(value) {} + + void set_value(bool value) + { + this->is_set = true; + this->value = value; + } + + void unset() + { + this->is_set = false; + } + + std::string to_string() + { + if (this->is_set == false) + return "unset"; + else if (this->value) + return "true"; + else + return "false"; + } + + bool is_set{false}; + bool value{false}; +}; diff --git a/src/utils/reload.cpp b/src/utils/reload.cpp index 348c5b5..fdca9bc 100644 --- a/src/utils/reload.cpp +++ b/src/utils/reload.cpp @@ -26,7 +26,7 @@ void reload_process() #ifdef USE_DATABASE try { open_database(); - } catch (const litesql::DatabaseError&) { + } catch (...) { log_warning("Re-using the previous database."); } #endif |