Added a test case for the switch module
[clinton/Smoothieware.git] / src / libs / ConfigValue.h
CommitLineData
df27a6a3 1/*
c295905f
AW
2 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
3 Smoothie is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
4 Smoothie is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
df27a6a3 5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
c295905f
AW
6*/
7
8#ifndef CONFIGVALUE_H
9#define CONFIGVALUE_H
10
c295905f 11#include <string>
a2f7633f 12using std::string;
c295905f
AW
13
14class ConfigValue{
15 public:
61134a65 16 ConfigValue();
a2f7633f
JM
17 ConfigValue(uint16_t *check_sums);
18 ConfigValue(const ConfigValue& to_copy);
19 ConfigValue& operator= (const ConfigValue& to_copy);
d41a043b 20 void clear();
61134a65
JM
21 ConfigValue* required();
22 float as_number();
23 int as_int();
61134a65 24 bool as_bool();
a2f7633f 25 string as_string();
61134a65
JM
26
27 ConfigValue* by_default(float val);
28 ConfigValue* by_default(string val);
29 ConfigValue* by_default(int val);
61134a65 30 bool is_inverted();
c295905f 31
a2f7633f
JM
32
33 friend class ConfigCache;
34 friend class Config;
35 friend class ConfigSource;
36 friend class Configurator;
f45e6161 37 friend class FileConfigSource;
a2f7633f
JM
38
39 private:
40 bool has_characters( const char* mask );
41 string value;
8bb1c877 42 int default_int;
1ad23cd3 43 float default_double;
df27a6a3 44 uint16_t check_sums[3];
c295905f
AW
45 bool found;
46 bool default_set;
c295905f
AW
47};
48
49
50
51
52
53
54
55
56#endif