mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Fixed location class test failures.
Also some minor tidying.
This commit is contained in:
@@ -51,7 +51,7 @@ namespace loot {
|
||||
namespace YAML {
|
||||
Emitter& operator << (Emitter& out, const loot::Location& rhs) {
|
||||
if (rhs.Versions().empty())
|
||||
out << rhs.URL();
|
||||
out << YAML::SingleQuoted << rhs.URL();
|
||||
else {
|
||||
out << BeginMap
|
||||
<< Key << "link" << Value << YAML::SingleQuoted << rhs.URL()
|
||||
|
||||
@@ -59,6 +59,9 @@ namespace YAML {
|
||||
}
|
||||
|
||||
static bool decode(const Node& node, loot::Location& rhs) {
|
||||
if (!node.IsMap() && !node.IsScalar())
|
||||
return false;
|
||||
|
||||
std::string url;
|
||||
std::vector<std::string> versions;
|
||||
|
||||
@@ -66,12 +69,10 @@ namespace YAML {
|
||||
if (!node["link"] || !node["ver"])
|
||||
return false;
|
||||
|
||||
if (node["link"])
|
||||
url = node["link"].as<std::string>();
|
||||
if (node["ver"])
|
||||
versions = node["ver"].as<std::vector<std::string>>();
|
||||
url = node["link"].as<std::string>();
|
||||
versions = node["ver"].as<std::vector<std::string>>();
|
||||
}
|
||||
else if (node.IsScalar())
|
||||
else
|
||||
url = node.as<std::string>();
|
||||
|
||||
rhs = loot::Location(url, versions);
|
||||
|
||||
Reference in New Issue
Block a user