[libcalamares] Convenience function YAML->QStringList

- operator>> already existed, but here's a version that
   can be used in function-call context.
This commit is contained in:
Adriaan de Groot 2019-03-18 17:38:44 -04:00
parent 43f6405714
commit 540d27d0c3
2 changed files with 12 additions and 0 deletions

View File

@ -109,6 +109,14 @@ yamlMapToVariant( const YAML::Node& mapNode )
return vm;
}
QStringList
yamlToStringList(const YAML::Node& listNode)
{
QStringList l;
listNode >> l;
return l;
}
void
explainYamlException( const YAML::Exception& e, const QByteArray& yamlData, const char *label )

View File

@ -32,6 +32,7 @@ class Node;
class Exception;
}
/// @brief Appends all te elements of @p node to the string list @p v
void operator>>( const YAML::Node& node, QStringList& v );
namespace CalamaresUtils
@ -51,6 +52,9 @@ QVariant yamlScalarToVariant( const YAML::Node& scalarNode );
QVariant yamlSequenceToVariant( const YAML::Node& sequenceNode );
QVariant yamlMapToVariant( const YAML::Node& mapNode );
/// @brief Returns all the elements of @p listNode in a StringList
QStringList yamlToStringList( const YAML::Node& listNode );
/// @brief Save a @p map to @p filename as YAML
bool saveYaml( const QString& filename, const QVariantMap& map );