summaryrefslogtreecommitdiffhomepage
path: root/options/base-value.cpp
blob: 9ccbbdf8d3929f6497794874ef23ddea7b19af09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;
}