This commit is contained in:
2020-04-29 17:26:30 +03:00
parent 3454971100
commit 43588d076f

View File

@@ -525,15 +525,16 @@ inline PICout operator <<(PICout s, const PIConfig::Entry & v) {s << v.value();
* from configuration file in implementation \a PIIODevice::configureDevice() function */
template<typename T>
T readDeviceSetting(const PIString & name, const T & def, const PIConfig::Entry * em, const PIConfig::Entry * ep) {
PIVariant v = PIVariant::fromValue<T>(T());
if (ep != 0) {
bool ex;
v.setValueFromString(ep->getValue(name, def, &ex).toString());
if (!ex) v.setValueFromString(em->getValue(name, def).toString());
PIVariant v = PIVariant::fromValue<T>(def);
if (ep) {
bool ex = false;
PIString sv = ep->getValue(name, def, &ex).toString();
if (!ex)
return def;
v.setValueFromString(sv);
return v.value<T>();
}
v.setValueFromString(em->getValue(name, def).toString());
return v.value<T>();
return def;
}
#endif // PICONFIG_H