| 1 | #include "Library/Yaml/Writer/ByamlWriterBigDataList.h" |
|---|---|
| 2 | |
| 3 | #include "Library/Yaml/Writer/ByamlWriterData.h" |
| 4 | |
| 5 | namespace al { |
| 6 | |
| 7 | ByamlWriterBigDataList::ByamlWriterBigDataList() = default; |
| 8 | |
| 9 | ByamlWriterBigDataList::~ByamlWriterBigDataList() { |
| 10 | while (auto* node = mList.popBack()) |
| 11 | delete node; |
| 12 | } |
| 13 | |
| 14 | void ByamlWriterBigDataList::addData(ByamlWriterBigData* data) { |
| 15 | mList.pushBack(item: new sead::TListNode<ByamlWriterBigData*>(data)); |
| 16 | } |
| 17 | |
| 18 | u32 ByamlWriterBigDataList::calcPackSize() const { |
| 19 | u32 size = 0; |
| 20 | for (auto& node : mList) |
| 21 | size += node->calcBigDataSize(); |
| 22 | return size; |
| 23 | } |
| 24 | |
| 25 | s32 ByamlWriterBigDataList::setOffset(s32 offset) { |
| 26 | for (auto& node : mList) { |
| 27 | node->setOffset(offset); |
| 28 | offset += node->calcBigDataSize(); |
| 29 | } |
| 30 | return offset; |
| 31 | } |
| 32 | |
| 33 | void ByamlWriterBigDataList::write(sead::WriteStream* stream) { |
| 34 | for (auto& node : mList) |
| 35 | node->writeBigData(stream); |
| 36 | } |
| 37 | |
| 38 | } // namespace al |
| 39 |