OpenCPN Partial API docs
Loading...
Searching...
No Matches
observable_confvar.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, write to the
17 * Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 **************************************************************************/
20
27#ifndef OBSERVABLE_CONFVAR_H
28#define OBSERVABLE_CONFVAR_H
29
30#include <memory>
31#include <string>
32
33#include <wx/config.h>
34
35#include "observable.h"
36
68template <typename T = std::string>
69class ConfigVar : public Observable {
70public:
71 ConfigVar(const std::string& section_, const std::string& key_,
72 wxConfigBase* cb);
73 ConfigVar() = delete;
74
75 void Set(const T& arg);
76
77 const T Get(const T& default_val);
78
79private:
80
81 const std::string section;
82 const std::string key;
83 wxConfigBase* const config;
84};
85
86#endif // OBSERVABLE_CONFVAR_H
Wrapper for configuration variables which lives in a wxBaseConfig object.
The observable notify/listen basic nuts and bolts.
Definition observable.h:100
General observable implementation with several specializations.