mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-10 21:11:18 +00:00
Implemented conversion for std::string, including a bypass-accessor to the scalar value
This commit is contained in:
17
src/value/convert.cpp
Normal file
17
src/value/convert.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "yaml-cpp/value.h"
|
||||
|
||||
namespace YAML
|
||||
{
|
||||
template<>
|
||||
Value convert(const std::string& rhs) {
|
||||
return Value(rhs);
|
||||
}
|
||||
|
||||
template<>
|
||||
bool convert(const Value& value, std::string& rhs) {
|
||||
if(value.Type() != ValueType::Scalar)
|
||||
return false;
|
||||
rhs = value.scalar();
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user