piconfig
This commit is contained in:
@@ -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 */
|
* from configuration file in implementation \a PIIODevice::configureDevice() function */
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T readDeviceSetting(const PIString & name, const T & def, const PIConfig::Entry * em, const PIConfig::Entry * ep) {
|
T readDeviceSetting(const PIString & name, const T & def, const PIConfig::Entry * em, const PIConfig::Entry * ep) {
|
||||||
PIVariant v = PIVariant::fromValue<T>(T());
|
PIVariant v = PIVariant::fromValue<T>(def);
|
||||||
if (ep != 0) {
|
if (ep) {
|
||||||
bool ex;
|
bool ex = false;
|
||||||
v.setValueFromString(ep->getValue(name, def, &ex).toString());
|
PIString sv = ep->getValue(name, def, &ex).toString();
|
||||||
if (!ex) v.setValueFromString(em->getValue(name, def).toString());
|
if (!ex)
|
||||||
|
return def;
|
||||||
|
v.setValueFromString(sv);
|
||||||
return v.value<T>();
|
return v.value<T>();
|
||||||
}
|
}
|
||||||
v.setValueFromString(em->getValue(name, def).toString());
|
return def;
|
||||||
return v.value<T>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // PICONFIG_H
|
#endif // PICONFIG_H
|
||||||
|
|||||||
Reference in New Issue
Block a user