[libcalamares] Tighten up types

- If we're converting a YAML map to a QVariant (Map), may as well
  express that in the types. This makes the return from, say,
  `yamlMapToVariant()` cheaper, but incurs conversion in
  `yamlToVariant()` .. previously the place for costs was
  swapped around.
- For those cases that want-and-expect a Map, or List, this makes
  the calls slightly cheaper. For the generic case, the costs move
  around internally.
main
Adriaan de Groot 5 years ago
parent 2eb84e2de1
commit 1678a03cb3

@ -89,7 +89,7 @@ yamlScalarToVariant( const YAML::Node& scalarNode )
}
QVariant
QVariantList
yamlSequenceToVariant( const YAML::Node& sequenceNode )
{
QVariantList vl;
@ -101,7 +101,7 @@ yamlSequenceToVariant( const YAML::Node& sequenceNode )
}
QVariant
QVariantMap
yamlMapToVariant( const YAML::Node& mapNode )
{
QVariantMap vm;

@ -22,6 +22,8 @@
#include <QStringList>
#include <QVariant>
#include <QVariantList>
#include <QVariantMap>
class QByteArray;
class QFileInfo;
@ -60,8 +62,8 @@ QVariantMap loadYaml( const QFileInfo&, bool* ok = nullptr );
QVariant yamlToVariant( const YAML::Node& node );
QVariant yamlScalarToVariant( const YAML::Node& scalarNode );
QVariant yamlSequenceToVariant( const YAML::Node& sequenceNode );
QVariant yamlMapToVariant( const YAML::Node& mapNode );
QVariantList yamlSequenceToVariant( const YAML::Node& sequenceNode );
QVariantMap yamlMapToVariant( const YAML::Node& mapNode );
/// @brief Returns all the elements of @p listNode in a StringList
QStringList yamlToStringList( const YAML::Node& listNode );

Loading…
Cancel
Save