Fixed location class test failures.

Also some minor tidying.
This commit is contained in:
Oliver Hamlet
2015-07-12 18:37:08 +01:00
parent 7e69dc667e
commit 66a8084b8f
2 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -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()
+6 -5
View File
@@ -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);