OpenCPN Partial API docs
Loading...
Searching...
No Matches
configvar.h
Go to the documentation of this file.
1/*************************************************************************
2 *
3 * Copyright (C) 2022 - 2025 Alec Leamas
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, see <https://www.gnu.org/licenses/>.
17 ************************************************************************/
18
25#ifndef OBSERVABLE_CONFVAR_H
26#define OBSERVABLE_CONFVAR_H
27
28#include <string>
29
30#include <wx/config.h>
31
32#include "observable.h"
33
34namespace obs {
67template <typename T = std::string>
68class ConfigVar : public Observable {
69public:
70 ConfigVar(const std::string& section_, const std::string& key_,
71 wxConfigBase* cb);
72 ConfigVar() = delete;
73
74 void Set(const T& arg);
75
76 T Get(const T& default_val);
77
78private:
79 const std::string m_section;
80 const std::string m_key;
81 wxConfigBase* const m_config;
82};
83
84} // namespace obs
85
86#endif // OBSERVABLE_CONFVAR_H
Wrapper for configuration variables which lives in a wxBaseConfig object.
Definition configvar.h:68
The observable notify/listen basic nuts and bolts.
Definition observable.h:100
General observable pattern implementation built on top of wxWidgets event handling.