Add PTMF YAML reader to go along with writer

This commit is contained in:
Jack Andersen 2016-10-01 13:18:19 -10:00
parent 779e741a91
commit d3d63082d0
1 changed files with 12 additions and 3 deletions

View File

@ -1203,9 +1203,8 @@ struct DNAYaml : DNA<DNAE>
return true; return true;
} }
typedef void (DNAYaml::*YAMLWriteMemFn)(YAMLDocWriter& out) const; typedef void (DNAYaml::*YAMLWriteMemberFn)(YAMLDocWriter& out) const;
bool toYAMLStream(athena::io::IStreamWriter& fout, YAMLWriteMemberFn fn) const
bool toYAMLStream(athena::io::IStreamWriter& fout, YAMLWriteMemFn fn) const
{ {
YAMLDocWriter docWriter(DNATypeV()); YAMLDocWriter docWriter(DNATypeV());
@ -1228,6 +1227,16 @@ struct DNAYaml : DNA<DNAE>
return true; return true;
} }
typedef void (DNAYaml::*YAMLReadMemberFn)(YAMLDocReader& in);
bool fromYAMLStream(athena::io::IStreamReader& fin, YAMLReadMemberFn fn)
{
YAMLDocReader docReader;
if (!docReader.parse(&fin))
return false;
(this->*fn)(docReader);
return true;
}
template<class DNASubtype> template<class DNASubtype>
static bool ValidateFromYAMLStream(athena::io::IStreamReader& fin) static bool ValidateFromYAMLStream(athena::io::IStreamReader& fin)
{ {