#include "athena/IStreamReader.hpp" #include "athena/IStreamWriter.hpp" #include "athena/FileWriter.hpp" #include "DGRP.hpp" namespace DataSpec { namespace DNADGRP { template void DGRP::read(athena::io::IStreamReader& __dna_reader) { /* dependCount */ dependCount = __dna_reader.readUint32Big(); /* depends */ __dna_reader.enumerate(depends, dependCount); } template void DGRP::write(athena::io::IStreamWriter& __dna_writer) const { /* dependCount */ __dna_writer.writeUint32Big(dependCount); /* depends */ __dna_writer.enumerate(depends); } template void DGRP::read(athena::io::YAMLDocReader& __dna_docin) { /* dependCount squelched */ /* depends */ dependCount = __dna_docin.enumerate("depends", depends); } template void DGRP::write(athena::io::YAMLDocWriter& __dna_docout) const { /* dependCount squelched */ /* depends */ __dna_docout.enumerate("depends", depends); } template const char* DGRP::DNAType() { return "urde::DGRP"; } template size_t DGRP::binarySize(size_t __isz) const { __isz = __EnumerateSize(__isz, depends); return __isz + 4; } template void DGRP::ObjectTag::read(athena::io::IStreamReader& __dna_reader) { /* type */ type.read(__dna_reader); /* id */ id.read(__dna_reader); } template void DGRP::ObjectTag::write(athena::io::IStreamWriter& __dna_writer) const { /* type */ type.write(__dna_writer); /* id */ id.write(__dna_writer); } template void DGRP::ObjectTag::read(athena::io::YAMLDocReader& __dna_docin) { /* type */ __dna_docin.enumerate("type", type); /* id */ __dna_docin.enumerate("id", id); } template void DGRP::ObjectTag::write(athena::io::YAMLDocWriter& __dna_docout) const { /* type */ __dna_docout.enumerate("type", type); /* id */ __dna_docout.enumerate("id", id); } template const char* DGRP::ObjectTag::DNAType() { return "urde::DGRP::ObjectTag"; } template size_t DGRP::ObjectTag::binarySize(size_t __isz) const { __isz = type.binarySize(__isz); __isz = id.binarySize(__isz); return __isz; } template struct DGRP; template struct DGRP; template bool ExtractDGRP(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) { FILE* fp = hecl::Fopen(outPath.getAbsolutePath().c_str(), _S("w")); if (fp) { DGRP dgrp; dgrp.read(rs); dgrp.toYAMLFile(fp); fclose(fp); return true; } return false; } template bool ExtractDGRP(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath); template bool ExtractDGRP(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath); template bool WriteDGRP(const DGRP& dgrp, const hecl::ProjectPath& outPath) { athena::io::FileWriter w(outPath.getAbsolutePath(), true, false); if (w.hasError()) return false; dgrp.write(w); int64_t rem = w.position() % 32; if (rem) for (int64_t i=0 ; i<32-rem ; ++i) w.writeBytes((atInt8*)"\xff", 1); return true; } template bool WriteDGRP(const DGRP& dgrp, const hecl::ProjectPath& outPath); template bool WriteDGRP(const DGRP& dgrp, const hecl::ProjectPath& outPath); } }