summaryrefslogtreecommitdiffhomepage
path: root/options/scoped.hpp
blob: 81e6bd191d91cfedccd69e4634dedbeaa820dd86 (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
34
35
36
37
38
39
#pragma once

#include "bundle.hpp"
#include "value.hpp"
#include <QString>

#include "export.hpp"

namespace options {

struct OTR_OPTIONS_EXPORT with_tracker_teardown final
{
    with_tracker_teardown();
    ~with_tracker_teardown();

private:
    bool old_value;
};

struct OTR_OPTIONS_EXPORT opts
{
    template<typename t> using value = options::value<t>;
    using bundle = options::bundle;

    bundle b;

    opts& operator=(const opts&) = delete;
    opts(const opts&) = delete;

    void set_raii_dtor_state(bool x) { raii = x; }

protected:
    explicit opts(const QString& name);
    ~opts();
private:
    bool raii = true;
};

}