diff options
Diffstat (limited to 'options/base-value.cpp')
| -rw-r--r-- | options/base-value.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/options/base-value.cpp b/options/base-value.cpp new file mode 100644 index 00000000..950629d0 --- /dev/null +++ b/options/base-value.cpp @@ -0,0 +1,33 @@ +#include "base-value.hpp" +#include <QThread> + +using namespace options; + +//#define OTR_TRACE_NOTIFY + +const bool value_::TRACE_NOTIFY = +#ifdef OTR_TRACE_NOTIFY + true; +#else + [] { + auto b = qgetenv("OTR_TRACE_NOTIFY"); + return !b.isEmpty() && b != "0"; + }(); +#endif + +value_::value_(bundle const& b, const QString& name) noexcept : + b(b), self_name(name) +{ + b->on_value_created(this); +} + +value_::~value_() +{ + b->on_value_destructed(this); +} + +void value_::maybe_trace(const char* str) const +{ + if (TRACE_NOTIFY) + qDebug().noquote() << str << QThread::currentThreadId() << b->name() << self_name << get_variant(); +} |
