mirror of
https://github.com/tristanpenman/valijson.git
synced 2024-12-12 10:13:51 +01:00
Fixed issue with YAML::Node reference usage.
This commit is contained in:
parent
7f23f3694b
commit
f03461bb01
@ -98,7 +98,7 @@ include_directories(include SYSTEM
|
||||
thirdparty/picojson-1.3.0
|
||||
thirdparty/nlohmann-json-3.1.2
|
||||
thirdparty/yaml-cpp-0.7.0/include
|
||||
)
|
||||
)
|
||||
|
||||
if(valijson_BUILD_TESTS)
|
||||
if(NOT valijson_EXCLUDE_BOOST)
|
||||
|
@ -115,7 +115,7 @@ class YamlCppArray
|
||||
}
|
||||
|
||||
/// Reference to the contained value
|
||||
const YAML::Node &m_value;
|
||||
const YAML::Node m_value;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -203,7 +203,7 @@ class YamlCppObject
|
||||
}
|
||||
|
||||
/// Reference to the contained object
|
||||
const YAML::Node &m_value;
|
||||
const YAML::Node m_value;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -222,7 +222,8 @@ class YamlCppFrozenValue : public FrozenValue
|
||||
*
|
||||
* @param source the YamlCpp value to be copied
|
||||
*/
|
||||
explicit YamlCppFrozenValue(YAML::Node source) : m_value(std::move(source))
|
||||
explicit YamlCppFrozenValue(YAML::Node source)
|
||||
: m_value(YAML::Clone(source))
|
||||
{
|
||||
}
|
||||
|
||||
@ -444,7 +445,7 @@ class YamlCppValue
|
||||
}
|
||||
|
||||
/// Reference to the contained YamlCpp value.
|
||||
const YAML::Node &m_value;
|
||||
const YAML::Node m_value;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -689,4 +690,4 @@ YamlCppObject::find(const std::string &propertyName) const
|
||||
}
|
||||
|
||||
} // namespace adapters
|
||||
} // namespace valijson
|
||||
} // namespace valijson
|
||||
|
@ -74,7 +74,9 @@ TEST_F(TestYamlCppAdapter, BasicObjectIteration)
|
||||
unsigned int expectedValue = 0;
|
||||
for (const valijson::adapters::YamlCppAdapter::ObjectMember member :
|
||||
adapter.getObject()) {
|
||||
ASSERT_TRUE(member.second.isNumber());
|
||||
ASSERT_TRUE(member.second.isString());
|
||||
ASSERT_FALSE(member.second.isNumber());
|
||||
ASSERT_TRUE(member.second.maybeDouble());
|
||||
EXPECT_EQ(std::to_string(expectedValue), member.first);
|
||||
EXPECT_EQ(double(expectedValue), member.second.getDouble());
|
||||
expectedValue++;
|
||||
|
Loading…
Reference in New Issue
Block a user