Add PTMF yaml stream writer

This commit is contained in:
Jack Andersen 2016-09-30 16:55:46 -10:00
parent 5074381533
commit 779e741a91
1 changed files with 16 additions and 0 deletions

View File

@ -1203,6 +1203,22 @@ struct DNAYaml : DNA<DNAE>
return true;
}
typedef void (DNAYaml::*YAMLWriteMemFn)(YAMLDocWriter& out) const;
bool toYAMLStream(athena::io::IStreamWriter& fout, YAMLWriteMemFn fn) const
{
YAMLDocWriter docWriter(DNATypeV());
yaml_emitter_set_unicode(docWriter.getEmitter(), true);
yaml_emitter_set_width(docWriter.getEmitter(), -1);
(this->*fn)(docWriter);
if (!docWriter.finish(&fout))
return false;
return true;
}
bool fromYAMLStream(athena::io::IStreamReader& fin)
{
YAMLDocReader docReader;