mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-11 07:18:11 -05:00
Reformat code with clang format
This commit is contained in:
@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "CommonStructuredDataEnum.h"
|
||||
#include "CommonStructuredDataStruct.h"
|
||||
#include "Utils/ClassUtils.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "Utils/ClassUtils.h"
|
||||
#include "CommonStructuredDataEnum.h"
|
||||
#include "CommonStructuredDataStruct.h"
|
||||
|
||||
class CommonStructuredDataDef
|
||||
{
|
||||
public:
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "CommonStructuredDataEnum.h"
|
||||
|
||||
#include "Utils/Endianness.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <zlib.h>
|
||||
|
||||
#include "Utils/Endianness.h"
|
||||
|
||||
CommonStructuredDataEnumEntry::CommonStructuredDataEnumEntry()
|
||||
: m_value(0u)
|
||||
{
|
||||
@ -60,16 +60,20 @@ uint32_t CommonStructuredDataEnum::CalculateChecksum(const uint32_t initialValue
|
||||
|
||||
void CommonStructuredDataEnum::SortEntriesByOffset()
|
||||
{
|
||||
std::sort(m_entries.begin(), m_entries.end(), [](const CommonStructuredDataEnumEntry& e1, const CommonStructuredDataEnumEntry& e2)
|
||||
{
|
||||
return e1.m_value < e2.m_value;
|
||||
});
|
||||
std::sort(m_entries.begin(),
|
||||
m_entries.end(),
|
||||
[](const CommonStructuredDataEnumEntry& e1, const CommonStructuredDataEnumEntry& e2)
|
||||
{
|
||||
return e1.m_value < e2.m_value;
|
||||
});
|
||||
}
|
||||
|
||||
void CommonStructuredDataEnum::SortEntriesByName()
|
||||
{
|
||||
std::sort(m_entries.begin(), m_entries.end(), [](const CommonStructuredDataEnumEntry& e1, const CommonStructuredDataEnumEntry& e2)
|
||||
{
|
||||
return e1.m_name < e2.m_name;
|
||||
});
|
||||
std::sort(m_entries.begin(),
|
||||
m_entries.end(),
|
||||
[](const CommonStructuredDataEnumEntry& e1, const CommonStructuredDataEnumEntry& e2)
|
||||
{
|
||||
return e1.m_name < e2.m_name;
|
||||
});
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
#include "Utils/ClassUtils.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Utils/ClassUtils.h"
|
||||
|
||||
struct CommonStructuredDataEnumEntry
|
||||
{
|
||||
std::string m_name;
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include "CommonStructuredDataStruct.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <zlib.h>
|
||||
|
||||
#include "CommonStructuredDataDef.h"
|
||||
#include "Utils/Endianness.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <zlib.h>
|
||||
|
||||
CommonStructuredDataStructProperty::CommonStructuredDataStructProperty()
|
||||
: m_offset_in_bits(0u)
|
||||
{
|
||||
@ -58,12 +58,12 @@ uint32_t CommonStructuredDataStruct::CalculateChecksum(const CommonStructuredDat
|
||||
switch (currentType.m_category)
|
||||
{
|
||||
case CommonStructuredDataTypeCategory::STRING:
|
||||
{
|
||||
const auto littleEndianStringLength = endianness::ToLittleEndian(currentType.m_info.string_length);
|
||||
checksum = crc32(checksum, reinterpret_cast<const Bytef*>(&littleEndianStringLength), sizeof(littleEndianStringLength));
|
||||
currentType = CommonStructuredDataType(CommonStructuredDataTypeCategory::UNKNOWN);
|
||||
}
|
||||
break;
|
||||
{
|
||||
const auto littleEndianStringLength = endianness::ToLittleEndian(currentType.m_info.string_length);
|
||||
checksum = crc32(checksum, reinterpret_cast<const Bytef*>(&littleEndianStringLength), sizeof(littleEndianStringLength));
|
||||
currentType = CommonStructuredDataType(CommonStructuredDataTypeCategory::UNKNOWN);
|
||||
}
|
||||
break;
|
||||
case CommonStructuredDataTypeCategory::ENUM:
|
||||
if (currentType.m_info.type_index < def.m_enums.size())
|
||||
{
|
||||
@ -118,16 +118,20 @@ uint32_t CommonStructuredDataStruct::CalculateChecksum(const CommonStructuredDat
|
||||
|
||||
void CommonStructuredDataStruct::SortPropertiesByOffset()
|
||||
{
|
||||
std::sort(m_properties.begin(), m_properties.end(), [](const CommonStructuredDataStructProperty& e1, const CommonStructuredDataStructProperty& e2)
|
||||
{
|
||||
return e1.m_offset_in_bits < e2.m_offset_in_bits;
|
||||
});
|
||||
std::sort(m_properties.begin(),
|
||||
m_properties.end(),
|
||||
[](const CommonStructuredDataStructProperty& e1, const CommonStructuredDataStructProperty& e2)
|
||||
{
|
||||
return e1.m_offset_in_bits < e2.m_offset_in_bits;
|
||||
});
|
||||
}
|
||||
|
||||
void CommonStructuredDataStruct::SortPropertiesByName()
|
||||
{
|
||||
std::sort(m_properties.begin(), m_properties.end(), [](const CommonStructuredDataStructProperty& e1, const CommonStructuredDataStructProperty& e2)
|
||||
{
|
||||
return e1.m_name < e2.m_name;
|
||||
});
|
||||
std::sort(m_properties.begin(),
|
||||
m_properties.end(),
|
||||
[](const CommonStructuredDataStructProperty& e1, const CommonStructuredDataStructProperty& e2)
|
||||
{
|
||||
return e1.m_name < e2.m_name;
|
||||
});
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
#include "CommonStructuredDataTypes.h"
|
||||
#include "Utils/ClassUtils.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Utils/ClassUtils.h"
|
||||
#include "CommonStructuredDataTypes.h"
|
||||
|
||||
struct CommonStructuredDataStructProperty
|
||||
{
|
||||
std::string m_name;
|
||||
@ -18,6 +18,7 @@ struct CommonStructuredDataStructProperty
|
||||
};
|
||||
|
||||
class CommonStructuredDataDef;
|
||||
|
||||
struct CommonStructuredDataStruct
|
||||
{
|
||||
std::string m_name;
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "CommonStructuredDataTypes.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "CommonStructuredDataDef.h"
|
||||
#include "Utils/Alignment.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
CommonStructuredDataType::CommonStructuredDataType()
|
||||
: m_category(CommonStructuredDataTypeCategory::UNKNOWN),
|
||||
m_info({0})
|
||||
@ -52,15 +52,15 @@ size_t CommonStructuredDataType::GetSizeInBits(const CommonStructuredDataDef& de
|
||||
}
|
||||
return def.m_structs[m_info.type_index]->m_size_in_byte * 8u;
|
||||
case CommonStructuredDataTypeCategory::INDEXED_ARRAY:
|
||||
{
|
||||
if (m_info.type_index >= def.m_indexed_arrays.size())
|
||||
{
|
||||
if (m_info.type_index >= def.m_indexed_arrays.size())
|
||||
{
|
||||
assert(false);
|
||||
return 0u;
|
||||
}
|
||||
const auto& indexedArray = def.m_indexed_arrays[m_info.type_index];
|
||||
return utils::Align(indexedArray.m_element_size_in_bits * indexedArray.m_element_count, 8u);
|
||||
assert(false);
|
||||
return 0u;
|
||||
}
|
||||
const auto& indexedArray = def.m_indexed_arrays[m_info.type_index];
|
||||
return utils::Align(indexedArray.m_element_size_in_bits * indexedArray.m_element_count, 8u);
|
||||
}
|
||||
case CommonStructuredDataTypeCategory::ENUM_ARRAY:
|
||||
{
|
||||
if (m_info.type_index >= def.m_enumed_arrays.size())
|
||||
@ -154,7 +154,10 @@ CommonStructuredDataEnumedArray::CommonStructuredDataEnumedArray(const CommonStr
|
||||
{
|
||||
}
|
||||
|
||||
CommonStructuredDataEnumedArray::CommonStructuredDataEnumedArray(const CommonStructuredDataType type, const size_t enumIndex, const size_t elementCount, const size_t elementSizeInBits)
|
||||
CommonStructuredDataEnumedArray::CommonStructuredDataEnumedArray(const CommonStructuredDataType type,
|
||||
const size_t enumIndex,
|
||||
const size_t elementCount,
|
||||
const size_t elementSizeInBits)
|
||||
: m_array_type(type),
|
||||
m_enum_index(enumIndex),
|
||||
m_element_count(elementCount),
|
||||
|
@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include "Utils/ClassUtils.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
enum class CommonStructuredDataTypeCategory
|
||||
{
|
||||
UNKNOWN,
|
||||
@ -26,6 +26,7 @@ union CommonStructuredDataTypeExtraInfo
|
||||
};
|
||||
|
||||
class CommonStructuredDataDef;
|
||||
|
||||
struct CommonStructuredDataType
|
||||
{
|
||||
CommonStructuredDataTypeCategory m_category;
|
||||
|
Reference in New Issue
Block a user