mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-26 06:11:53 +00:00
Reformat code with clang format
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Zone/Stream/IZoneStream.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <typeindex>
|
||||
#include <typeinfo>
|
||||
|
||||
#include "Zone/Stream/IZoneStream.h"
|
||||
|
||||
class IZoneOutputStream : public IZoneStream
|
||||
{
|
||||
public:
|
||||
@ -23,44 +23,37 @@ public:
|
||||
virtual void ReusableAddOffset(void* ptr, size_t size, size_t count, std::type_index type) = 0;
|
||||
virtual void MarkFollowing(void** pPtr) = 0;
|
||||
|
||||
template<typename T>
|
||||
bool ReusableShouldWrite(T** pPtr)
|
||||
template<typename T> bool ReusableShouldWrite(T** pPtr)
|
||||
{
|
||||
return ReusableShouldWrite(reinterpret_cast<void**>(reinterpret_cast<uintptr_t>(pPtr)), sizeof(T), std::type_index(typeid(T)));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void ReusableAddOffset(T* ptr)
|
||||
template<typename T> void ReusableAddOffset(T* ptr)
|
||||
{
|
||||
ReusableAddOffset(const_cast<void*>(reinterpret_cast<const void*>(ptr)), sizeof(T), 1, std::type_index(typeid(T)));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void ReusableAddOffset(T* ptr, const size_t count)
|
||||
template<typename T> void ReusableAddOffset(T* ptr, const size_t count)
|
||||
{
|
||||
ReusableAddOffset(const_cast<void*>(reinterpret_cast<const void*>(ptr)), sizeof(T), count, std::type_index(typeid(T)));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* Write(T* dst)
|
||||
template<typename T> T* Write(T* dst)
|
||||
{
|
||||
return static_cast<T*>(WriteDataInBlock(reinterpret_cast<const void*>(dst), sizeof(T)));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* Write(T* dst, const uint32_t count)
|
||||
template<typename T> T* Write(T* dst, const uint32_t count)
|
||||
{
|
||||
return static_cast<T*>(WriteDataInBlock(reinterpret_cast<const void*>(dst), count * sizeof(T)));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* WritePartial(T* dst, const size_t size)
|
||||
template<typename T> T* WritePartial(T* dst, const size_t size)
|
||||
{
|
||||
return static_cast<T*>(WriteDataInBlock(reinterpret_cast<const void*>(dst), size));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void MarkFollowing(T*& ptr)
|
||||
template<typename T> void MarkFollowing(T*& ptr)
|
||||
{
|
||||
MarkFollowing(reinterpret_cast<void**>(reinterpret_cast<uintptr_t>(&ptr)));
|
||||
}
|
||||
|
@ -15,7 +15,8 @@ InMemoryZoneOutputStream::ReusableEntry::ReusableEntry(void* startPtr, const siz
|
||||
: m_start_ptr(startPtr),
|
||||
m_end_ptr(reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(startPtr) + entrySize * entryCount)),
|
||||
m_start_zone_ptr(startZonePtr),
|
||||
m_entry_size(entrySize), m_entry_count(entryCount)
|
||||
m_entry_size(entrySize),
|
||||
m_entry_count(entryCount)
|
||||
{
|
||||
}
|
||||
|
||||
@ -184,16 +185,16 @@ bool InMemoryZoneOutputStream::ReusableShouldWrite(void** pPtr, const size_t ent
|
||||
return true;
|
||||
}
|
||||
|
||||
for(const auto& entry : foundEntriesForType->second)
|
||||
for (const auto& entry : foundEntriesForType->second)
|
||||
{
|
||||
if(*pPtr >= entry.m_start_ptr && *pPtr < entry.m_end_ptr)
|
||||
if (*pPtr >= entry.m_start_ptr && *pPtr < entry.m_end_ptr)
|
||||
{
|
||||
assert((reinterpret_cast<uintptr_t>(*pPtr) - reinterpret_cast<uintptr_t>(entry.m_start_ptr)) % entrySize == 0);
|
||||
*pPtr = reinterpret_cast<void*>(entry.m_start_zone_ptr + (reinterpret_cast<uintptr_t>(*pPtr) - reinterpret_cast<uintptr_t>(entry.m_start_ptr)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
#include "Writing/InMemoryZoneData.h"
|
||||
#include "Zone/Stream/IZoneOutputStream.h"
|
||||
#include "Zone/XBlock.h"
|
||||
|
||||
#include <stack>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "Writing/InMemoryZoneData.h"
|
||||
#include "Zone/XBlock.h"
|
||||
#include "Zone/Stream/IZoneOutputStream.h"
|
||||
|
||||
class InMemoryZoneOutputStream final : public IZoneOutputStream
|
||||
{
|
||||
class ReusableEntry
|
||||
|
Reference in New Issue
Block a user