mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-17 18:27:56 -05:00
Reformat code with clang format
This commit is contained in:
@ -1,17 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
#include "Zone/Stream/IZoneStream.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
class IZoneInputStream : public IZoneStream
|
||||
{
|
||||
public:
|
||||
virtual void* Alloc(unsigned align) = 0;
|
||||
|
||||
template<typename T>
|
||||
T* Alloc(const unsigned align)
|
||||
template<typename T> T* Alloc(const unsigned align)
|
||||
{
|
||||
return static_cast<T*>(Alloc(align));
|
||||
}
|
||||
@ -21,41 +20,38 @@ public:
|
||||
virtual void IncBlockPos(size_t size) = 0;
|
||||
virtual void LoadNullTerminated(void* dst) = 0;
|
||||
|
||||
template<typename T>
|
||||
void Load(T* dst)
|
||||
template<typename T> void Load(T* dst)
|
||||
{
|
||||
LoadDataInBlock(const_cast<void*>(reinterpret_cast<const void*>(dst)), sizeof(T));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void Load(T* dst, const uint32_t count)
|
||||
template<typename T> void Load(T* dst, const uint32_t count)
|
||||
{
|
||||
LoadDataInBlock(const_cast<void*>(reinterpret_cast<const void*>(dst)), count * sizeof(T));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void LoadPartial(T* dst, const size_t size)
|
||||
template<typename T> void LoadPartial(T* dst, const size_t size)
|
||||
{
|
||||
LoadDataInBlock(const_cast<void*>(reinterpret_cast<const void*>(dst)), size);
|
||||
}
|
||||
|
||||
virtual void** InsertPointer() = 0;
|
||||
template<typename T>
|
||||
T** InsertPointer()
|
||||
|
||||
template<typename T> T** InsertPointer()
|
||||
{
|
||||
return reinterpret_cast<T**>(InsertPointer());
|
||||
}
|
||||
|
||||
virtual void* ConvertOffsetToPointer(const void* offset) = 0;
|
||||
template<typename T>
|
||||
T* ConvertOffsetToPointer(T* offset)
|
||||
|
||||
template<typename T> T* ConvertOffsetToPointer(T* offset)
|
||||
{
|
||||
return static_cast<T*>(ConvertOffsetToPointer(static_cast<const void*>(offset)));
|
||||
}
|
||||
|
||||
virtual void* ConvertOffsetToAlias(const void* offset) = 0;
|
||||
template<typename T>
|
||||
T* ConvertOffsetToAlias(T* offset)
|
||||
|
||||
template<typename T> T* ConvertOffsetToAlias(T* offset)
|
||||
{
|
||||
return static_cast<T*>(ConvertOffsetToAlias(static_cast<const void*>(offset)));
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
#include "XBlockInputStream.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
#include "Loading/Exception/BlockOverflowException.h"
|
||||
#include "Loading/Exception/InvalidOffsetBlockException.h"
|
||||
#include "Loading/Exception/InvalidOffsetBlockOffsetException.h"
|
||||
#include "Loading/Exception/OutOfBlockBoundsException.h"
|
||||
|
||||
XBlockInputStream::XBlockInputStream(std::vector<XBlock*>& blocks, ILoadingStream* stream, const int blockBitCount,
|
||||
const block_t insertBlock) : m_blocks(blocks)
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
XBlockInputStream::XBlockInputStream(std::vector<XBlock*>& blocks, ILoadingStream* stream, const int blockBitCount, const block_t insertBlock)
|
||||
: m_blocks(blocks)
|
||||
{
|
||||
m_stream = stream;
|
||||
|
||||
@ -51,7 +51,7 @@ void XBlockInputStream::PushBlock(const block_t block)
|
||||
|
||||
m_block_stack.push(newBlock);
|
||||
|
||||
if(newBlock->m_type == XBlock::Type::BLOCK_TYPE_TEMP)
|
||||
if (newBlock->m_type == XBlock::Type::BLOCK_TYPE_TEMP)
|
||||
{
|
||||
m_temp_offsets.push(m_block_offsets[newBlock->m_index]);
|
||||
}
|
||||
@ -140,7 +140,6 @@ void XBlockInputStream::LoadDataInBlock(void* dst, const size_t size)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
IncBlockPos(size);
|
||||
}
|
||||
|
||||
@ -183,8 +182,7 @@ void XBlockInputStream::LoadNullTerminated(void* dst)
|
||||
|
||||
m_stream->Load(&byte, 1);
|
||||
block->m_buffer[offset++] = byte;
|
||||
}
|
||||
while (byte != 0);
|
||||
} while (byte != 0);
|
||||
|
||||
m_block_offsets[block->m_index] = offset;
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Loading/ILoadingStream.h"
|
||||
#include "Zone/Stream/IZoneInputStream.h"
|
||||
#include "Zone/XBlock.h"
|
||||
#include "Loading/ILoadingStream.h"
|
||||
|
||||
#include <vector>
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
|
||||
class XBlockInputStream final : public IZoneInputStream
|
||||
{
|
||||
@ -39,5 +39,4 @@ public:
|
||||
|
||||
void* ConvertOffsetToPointer(const void* offset) override;
|
||||
void* ConvertOffsetToAlias(const void* offset) override;
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user