refactor: hide implementation of loading steps inside file

This commit is contained in:
Jan
2025-05-02 21:12:48 +01:00
parent 955df98279
commit b92e85dc14
31 changed files with 649 additions and 477 deletions

View File

@ -2,20 +2,37 @@
#include "Zone/Stream/ZoneInputStream.h"
StepLoadZoneContent::StepLoadZoneContent(std::unique_ptr<IContentLoadingEntryPoint> entryPoint,
Zone* zone,
const int offsetBlockBitCount,
const block_t insertBlock)
: m_content_loader(std::move(entryPoint)),
m_zone(zone),
m_offset_block_bit_count(offsetBlockBitCount),
m_insert_block(insertBlock)
namespace
{
}
class StepLoadZoneContent final : public ILoadingStep
{
public:
StepLoadZoneContent(std::unique_ptr<IContentLoadingEntryPoint> entryPoint, const int offsetBlockBitCount, const block_t insertBlock)
: m_content_loader(std::move(entryPoint)),
m_offset_block_bit_count(offsetBlockBitCount),
m_insert_block(insertBlock)
{
}
void StepLoadZoneContent::PerformStep(ZoneLoader& zoneLoader, ILoadingStream& stream)
void PerformStep(ZoneLoader& zoneLoader, ILoadingStream& stream) override
{
const auto inputStream = ZoneInputStream::Create(zoneLoader.m_blocks, stream, m_offset_block_bit_count, m_insert_block);
m_content_loader->Load(*inputStream);
}
private:
std::unique_ptr<IContentLoadingEntryPoint> m_content_loader;
int m_offset_block_bit_count;
block_t m_insert_block;
};
} // namespace
namespace step
{
const auto inputStream = ZoneInputStream::Create(zoneLoader.m_blocks, stream, m_offset_block_bit_count, m_insert_block);
m_content_loader->Load(*inputStream);
}
std::unique_ptr<ILoadingStep>
CreateStepLoadZoneContent(std::unique_ptr<IContentLoadingEntryPoint> entryPoint, const int offsetBlockBitCount, const block_t insertBlock)
{
return std::make_unique<StepLoadZoneContent>(std::move(entryPoint), offsetBlockBitCount, insertBlock);
}
} // namespace step