[libcalamares] Another convenience config-extraction function

main
Adriaan de Groot 7 years ago
parent c7120277ca
commit e83b4d33f8

@ -340,6 +340,18 @@ getBool( const QVariantMap& map, const QString& key, bool d )
return result;
}
QString
getString(const QVariantMap& map, const QString& key)
{
if ( map.contains( key ) )
{
auto v = map.value( key );
if ( v.type() == QVariant::String )
return v.toString();
}
return QString();
}
QVariantMap
getSubMap( const QVariantMap& map, const QString& key, bool& success )
{

@ -104,6 +104,11 @@ namespace CalamaresUtils
*/
DLLEXPORT bool getBool( const QVariantMap& map, const QString& key, bool d );
/**
* Get a string value from a mapping; returns empty QString if no value.
*/
DLLEXPORT QString getString( const QVariantMap& map, const QString& key );
/**
* Returns a sub-map (i.e. a nested map) from the given mapping with the
* given key. @p success is set to true if the @p key exists

Loading…
Cancel
Save