mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 04:41:16 +00:00
Added alias
This commit is contained in:
@@ -513,6 +513,18 @@ namespace YAML
|
||||
if(!good())
|
||||
return *this;
|
||||
|
||||
if(m_pState->HasAnchor() || m_pState->HasTag()) {
|
||||
m_pState->SetError(ErrorMsg::INVALID_ALIAS);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PrepareNode(EmitterNodeType::Scalar);
|
||||
|
||||
if(!Utils::WriteAlias(m_stream, alias.content)) {
|
||||
m_pState->SetError(ErrorMsg::INVALID_ALIAS);
|
||||
return *this;
|
||||
}
|
||||
|
||||
m_pState->BeginScalar();
|
||||
|
||||
return *this;
|
||||
|
@@ -9,13 +9,13 @@ int main()
|
||||
out << "foo";
|
||||
out << YAML::LocalTag("hi") << "bar";
|
||||
out << YAML::Anchor("asdf") << YAML::BeginMap;
|
||||
out << "a" << "b" << "c" << YAML::Newline;
|
||||
out << "a" << "b" << "c";
|
||||
out << YAML::Anchor("a") << YAML::BeginMap;
|
||||
out << "a" << "b";
|
||||
out << YAML::Anchor("d") << "a" << "b";
|
||||
out << YAML::EndMap;
|
||||
out << YAML::EndMap;
|
||||
out << YAML::LocalTag("hi") << YAML::BeginSeq;
|
||||
out << "a" << "b";
|
||||
out << "a" << "b" << YAML::Alias("monkey");
|
||||
out << YAML::EndSeq;
|
||||
out << YAML::EndSeq;
|
||||
|
||||
|
Reference in New Issue
Block a user