OXYGENHUB
◆ main openmsx / src / settings / FloatSetting.hh
988 B · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#ifndef FLOATSETTING_HH
2
#define FLOATSETTING_HH
3
4
#include "Setting.hh"
5
6
namespace openmsx {
7
8
/** A Setting with a floating point value.
9
  */
10
class FloatSetting final : public Setting
11
{
12
public:
13
	FloatSetting(CommandController& commandController,
14
	             std::string_view name, static_string_view description,
15
	             double initialValue, double minValue, double maxValue,
16
	             Save save = Save::YES);
17
18
	[[nodiscard]] std::string_view getTypeString() const override;
19
	void additionalInfo(TclObject& result) const override;
20
21
	[[nodiscard]] double getDouble() const noexcept { return getValue().getDouble(getInterpreter()); }
22
	[[nodiscard]] float  getFloat()  const noexcept { return getValue().getFloat (getInterpreter()); }
23
	void setDouble(double d);
24
	void setFloat (float f);
25
26
	double getMinValue() const { return minValue; }
27
	double getMaxValue() const { return maxValue; }
28
29
private:
30
	const double minValue;
31
	const double maxValue;
32
};
33
34
} // namespace openmsx
35
36
#endif