mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Added alias
This commit is contained in:
@@ -513,6 +513,18 @@ namespace YAML
|
|||||||
if(!good())
|
if(!good())
|
||||||
return *this;
|
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();
|
m_pState->BeginScalar();
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
@@ -9,13 +9,13 @@ int main()
|
|||||||
out << "foo";
|
out << "foo";
|
||||||
out << YAML::LocalTag("hi") << "bar";
|
out << YAML::LocalTag("hi") << "bar";
|
||||||
out << YAML::Anchor("asdf") << YAML::BeginMap;
|
out << YAML::Anchor("asdf") << YAML::BeginMap;
|
||||||
out << "a" << "b" << "c" << YAML::Newline;
|
out << "a" << "b" << "c";
|
||||||
out << YAML::Anchor("a") << YAML::BeginMap;
|
out << YAML::Anchor("a") << YAML::BeginMap;
|
||||||
out << "a" << "b";
|
out << YAML::Anchor("d") << "a" << "b";
|
||||||
out << YAML::EndMap;
|
out << YAML::EndMap;
|
||||||
out << YAML::EndMap;
|
out << YAML::EndMap;
|
||||||
out << YAML::LocalTag("hi") << YAML::BeginSeq;
|
out << YAML::LocalTag("hi") << YAML::BeginSeq;
|
||||||
out << "a" << "b";
|
out << "a" << "b" << YAML::Alias("monkey");
|
||||||
out << YAML::EndSeq;
|
out << YAML::EndSeq;
|
||||||
out << YAML::EndSeq;
|
out << YAML::EndSeq;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user