mirror of
https://github.com/parchlinux/calamares.git
synced 2025-07-03 12:25:38 -04:00
[libcalamares] Another convenience config-extraction function
This commit is contained in:
parent
c7120277ca
commit
e83b4d33f8
2 changed files with 17 additions and 0 deletions
|
@ -340,6 +340,18 @@ getBool( const QVariantMap& map, const QString& key, bool d )
|
||||||
return result;
|
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
|
QVariantMap
|
||||||
getSubMap( const QVariantMap& map, const QString& key, bool& success )
|
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 );
|
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
|
* 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
|
* given key. @p success is set to true if the @p key exists
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue