Use unique_ptr for ZoneLoading

This commit is contained in:
Jan
2021-03-14 12:34:50 +01:00
parent 94230cefb0
commit 301f6e3e7a
14 changed files with 118 additions and 153 deletions

View File

@ -2,18 +2,12 @@
#include "Zone/Stream/Impl/XBlockInputStream.h"
#include <cassert>
StepLoadZoneContent::StepLoadZoneContent(IContentLoadingEntryPoint* entryPoint, Zone* zone, const int offsetBlockBitCount, const block_t insertBlock)
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)
{
m_content_loader = entryPoint;
m_zone = zone;
m_offset_block_bit_count = offsetBlockBitCount;
m_insert_block = insertBlock;
}
StepLoadZoneContent::~StepLoadZoneContent()
{
delete m_content_loader;
m_content_loader = nullptr;
}
void StepLoadZoneContent::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream)
@ -23,4 +17,4 @@ void StepLoadZoneContent::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* st
m_content_loader->Load(m_zone, inputStream);
delete inputStream;
}
}