openMSX
Main Page
Namespaces
Classes
Files
File List
File Members
settings
SettingRangePolicy.hh
Go to the documentation of this file.
1
#ifndef SETTINGRANGEPOLICY_HH
2
#define SETTINGRANGEPOLICY_HH
3
4
#include "
SettingPolicy.hh
"
5
#include "
TclObject.hh
"
6
#include <algorithm>
7
8
namespace
openmsx {
9
10
template
<
typename
T>
class
SettingRangePolicy
:
public
SettingPolicy
<T>
11
{
12
protected
:
13
SettingRangePolicy
(T minValue_, T maxValue_)
14
: minValue(minValue_), maxValue(maxValue_)
15
{
16
}
17
18
void
checkSetValue
(T& value)
19
{
20
value = std::min(std::max(value, minValue), maxValue);
21
}
22
23
T
getMinValue
()
const
{
return
minValue; }
24
T
getMaxValue
()
const
{
return
maxValue; }
25
26
void
additionalInfo
(
TclObject
& result)
const
27
{
28
TclObject
range(result.
getInterpreter
());
29
range.
addListElement
(
getMinValue
());
30
range.addListElement(
getMaxValue
());
31
result.
addListElement
(range);
32
}
33
34
private
:
35
const
T minValue;
36
const
T maxValue;
37
};
38
39
}
// namespace openmsx
40
41
#endif
Generated on Tue Jul 2 2013 22:18:08 for openMSX by
1.8.1.2