| 62 | } |
| 63 | |
| 64 | int mitk::Preferences::GetInt(const std::string& key, int def) const |
| 65 | { |
| 66 | auto value = this->FindValue(key); |
| 67 | |
| 68 | if (!value.has_value()) |
| 69 | return def; |
| 70 | |
| 71 | try |
| 72 | { |
| 73 | return std::stoi(value.value()); |
| 74 | } |
| 75 | catch (...) |
| 76 | { |
| 77 | mitkThrow() << "The property [\"" << key << "\": \"" << value.value() << "\"] does not represent a valid int value!"; |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | void mitk::Preferences::PutInt(const std::string& key, int value) |
| 82 | { |