| 1 | /* |
| 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. |
| 5 | You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>. |
| 6 | */ |
| 7 | |
| 8 | #ifndef CONFIGVALUE_H |
| 9 | #define CONFIGVALUE_H |
| 10 | |
| 11 | #include <string> |
| 12 | using std::string; |
| 13 | |
| 14 | class ConfigValue{ |
| 15 | public: |
| 16 | ConfigValue(); |
| 17 | ConfigValue(uint16_t *check_sums); |
| 18 | ConfigValue(const ConfigValue& to_copy); |
| 19 | ConfigValue& operator= (const ConfigValue& to_copy); |
| 20 | void clear(); |
| 21 | ConfigValue* required(); |
| 22 | float as_number(); |
| 23 | int as_int(); |
| 24 | bool as_bool(); |
| 25 | string as_string(); |
| 26 | |
| 27 | ConfigValue* by_default(float val); |
| 28 | ConfigValue* by_default(string val); |
| 29 | ConfigValue* by_default(int val); |
| 30 | bool is_inverted(); |
| 31 | |
| 32 | |
| 33 | friend class ConfigCache; |
| 34 | friend class Config; |
| 35 | friend class ConfigSource; |
| 36 | friend class Configurator; |
| 37 | |
| 38 | private: |
| 39 | bool has_characters( const char* mask ); |
| 40 | string value; |
| 41 | int default_int; |
| 42 | float default_double; |
| 43 | uint16_t check_sums[3]; |
| 44 | bool found; |
| 45 | bool default_set; |
| 46 | }; |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | #endif |