1.5: Fuckin' UE5... #38

Manually merged
williamjcm merged 126 commits from one-point-five into master 2024-07-22 11:06:13 +02:00
50 changed files with 280 additions and 234 deletions
Showing only changes of commit 3c79f39046 - Show all commits

24
src/BinaryIo/BinaryIo.h Normal file
View file

@ -0,0 +1,24 @@
#pragma once
// MassBuilderSaveTool
// Copyright (C) 2021-2024 Guillaume Jacquemin
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
namespace BinaryIo {
class Reader;
class Writer;
}

View file

@ -21,11 +21,11 @@
#include "../Logger/Logger.h" #include "../Logger/Logger.h"
#include "BinaryReader.h" #include "Reader.h"
namespace Gvas { namespace BinaryIo {
BinaryReader::BinaryReader(Containers::StringView filename) { Reader::Reader(Containers::StringView filename) {
_file = std::fopen(filename.data(), "rb"); _file = std::fopen(filename.data(), "rb");
if(!_file) { if(!_file) {
@ -33,93 +33,93 @@ BinaryReader::BinaryReader(Containers::StringView filename) {
} }
} }
BinaryReader::~BinaryReader() { Reader::~Reader() {
closeFile(); closeFile();
} }
bool bool
BinaryReader::open() { Reader::open() {
return _file; return _file;
} }
bool bool
BinaryReader::eof() { Reader::eof() {
return std::feof(_file) != 0; return std::feof(_file) != 0;
} }
std::int64_t std::int64_t
BinaryReader::position() { Reader::position() {
return _ftelli64(_file); return _ftelli64(_file);
} }
bool bool
BinaryReader::seek(std::int64_t position) { Reader::seek(std::int64_t position) {
return _fseeki64(_file, position, SEEK_SET) == 0; return _fseeki64(_file, position, SEEK_SET) == 0;
} }
void void
BinaryReader::closeFile() { Reader::closeFile() {
std::fclose(_file); std::fclose(_file);
_file = nullptr; _file = nullptr;
} }
bool bool
BinaryReader::readChar(char& value) { Reader::readChar(char& value) {
return std::fread(&value, sizeof(char), 1, _file) == 1; return std::fread(&value, sizeof(char), 1, _file) == 1;
} }
bool bool
BinaryReader::readInt8(std::int8_t& value) { Reader::readInt8(std::int8_t& value) {
return std::fread(&value, sizeof(std::int8_t), 1, _file) == 1; return std::fread(&value, sizeof(std::int8_t), 1, _file) == 1;
} }
bool bool
BinaryReader::readUint8(std::uint8_t& value) { Reader::readUint8(std::uint8_t& value) {
return std::fread(&value, sizeof(std::uint8_t), 1, _file) == 1; return std::fread(&value, sizeof(std::uint8_t), 1, _file) == 1;
} }
bool bool
BinaryReader::readInt16(std::int16_t& value) { Reader::readInt16(std::int16_t& value) {
return std::fread(&value, sizeof(std::int16_t), 1, _file) == 1; return std::fread(&value, sizeof(std::int16_t), 1, _file) == 1;
} }
bool bool
BinaryReader::readUint16(std::uint16_t& value) { Reader::readUint16(std::uint16_t& value) {
return std::fread(&value, sizeof(std::uint16_t), 1, _file) == 1; return std::fread(&value, sizeof(std::uint16_t), 1, _file) == 1;
} }
bool bool
BinaryReader::readInt32(std::int32_t& value) { Reader::readInt32(std::int32_t& value) {
return std::fread(&value, sizeof(std::int32_t), 1, _file) == 1; return std::fread(&value, sizeof(std::int32_t), 1, _file) == 1;
} }
bool bool
BinaryReader::readUint32(std::uint32_t& value) { Reader::readUint32(std::uint32_t& value) {
return std::fread(&value, sizeof(std::uint32_t), 1, _file) == 1; return std::fread(&value, sizeof(std::uint32_t), 1, _file) == 1;
} }
bool bool
BinaryReader::readInt64(std::int64_t& value) { Reader::readInt64(std::int64_t& value) {
return std::fread(&value, sizeof(std::int64_t), 1, _file) == 1; return std::fread(&value, sizeof(std::int64_t), 1, _file) == 1;
} }
bool bool
BinaryReader::readUint64(std::uint64_t& value) { Reader::readUint64(std::uint64_t& value) {
return std::fread(&value, sizeof(std::uint64_t), 1, _file) == 1; return std::fread(&value, sizeof(std::uint64_t), 1, _file) == 1;
} }
bool bool
BinaryReader::readFloat(float& value) { Reader::readFloat(float& value) {
return std::fread(&value, sizeof(float), 1, _file) == 1; return std::fread(&value, sizeof(float), 1, _file) == 1;
} }
bool bool
BinaryReader::readDouble(double& value) { Reader::readDouble(double& value) {
return std::fread(&value, sizeof(double), 1, _file) == 1; return std::fread(&value, sizeof(double), 1, _file) == 1;
} }
bool bool
BinaryReader::readArray(Containers::Array<char>& array, std::size_t count) { Reader::readArray(Containers::Array<char>& array, std::size_t count) {
if(array.size() < count) { if(array.size() < count) {
array = Containers::Array<char>{ValueInit, count}; array = Containers::Array<char>{ValueInit, count};
} }
@ -128,7 +128,7 @@ BinaryReader::readArray(Containers::Array<char>& array, std::size_t count) {
} }
bool bool
BinaryReader::readUEString(Containers::String& str) { Reader::readUEString(Containers::String& str) {
std::uint32_t length = 0; std::uint32_t length = 0;
if(!readUint32(length) || length == 0) { if(!readUint32(length) || length == 0) {
return false; return false;
@ -140,7 +140,7 @@ BinaryReader::readUEString(Containers::String& str) {
} }
std::int32_t std::int32_t
BinaryReader::peekChar() { Reader::peekChar() {
std::int32_t c; std::int32_t c;
c = std::fgetc(_file); c = std::fgetc(_file);
std::ungetc(c, _file); std::ungetc(c, _file);

View file

@ -25,12 +25,18 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas { namespace BinaryIo {
class BinaryReader { class Reader {
public: public:
explicit BinaryReader(Containers::StringView filename); explicit Reader(Containers::StringView filename);
~BinaryReader(); ~Reader();
Reader(const Reader& other) = delete;
Reader& operator=(const Reader& other) = delete;
Reader(Reader&& other) = default;
Reader& operator=(Reader&& other) = default;
bool open(); bool open();
bool eof(); bool eof();

View file

@ -18,52 +18,52 @@
#include "../Logger/Logger.h" #include "../Logger/Logger.h"
#include "BinaryWriter.h" #include "Writer.h"
using namespace Containers::Literals; using namespace Containers::Literals;
namespace Gvas { namespace BinaryIo {
BinaryWriter::BinaryWriter(Containers::StringView filename) { Writer::Writer(Containers::StringView filename) {
_file = std::fopen(filename.data(), "wb"); _file = std::fopen(filename.data(), "wb");
if(!_file) { if(!_file) {
LOG_ERROR_FORMAT("Couldn't open {} for reading: {}", filename, std::strerror(errno)); LOG_ERROR_FORMAT("Couldn't open {} for reading: {}", filename, std::strerror(errno));
} }
} }
BinaryWriter::~BinaryWriter() { Writer::~Writer() {
closeFile(); closeFile();
} }
bool bool
BinaryWriter::open() { Writer::open() {
return _file; return _file;
} }
void void
BinaryWriter::closeFile() { Writer::closeFile() {
std::fflush(_file); std::fflush(_file);
std::fclose(_file); std::fclose(_file);
_file = nullptr; _file = nullptr;
} }
std::int64_t std::int64_t
BinaryWriter::position() { Writer::position() {
return _ftelli64(_file); return _ftelli64(_file);
} }
Containers::ArrayView<const char> Containers::ArrayView<const char>
BinaryWriter::array() const { Writer::array() const {
return _data; return _data;
} }
std::size_t std::size_t
BinaryWriter::arrayPosition() const { Writer::arrayPosition() const {
return _index; return _index;
} }
bool bool
BinaryWriter::flushToFile() { Writer::flushToFile() {
bool ret = writeArray(_data); bool ret = writeArray(_data);
std::fflush(_file); std::fflush(_file);
_data = Containers::Array<char>{}; _data = Containers::Array<char>{};
@ -72,62 +72,62 @@ BinaryWriter::flushToFile() {
} }
bool bool
BinaryWriter::writeChar(char value) { Writer::writeChar(char value) {
return std::fwrite(&value, sizeof(char), 1, _file) == 1; return std::fwrite(&value, sizeof(char), 1, _file) == 1;
} }
bool bool
BinaryWriter::writeInt8(std::int8_t value) { Writer::writeInt8(std::int8_t value) {
return std::fwrite(&value, sizeof(std::int8_t), 1, _file) == 1; return std::fwrite(&value, sizeof(std::int8_t), 1, _file) == 1;
} }
bool bool
BinaryWriter::writeUint8(std::uint8_t value) { Writer::writeUint8(std::uint8_t value) {
return std::fwrite(&value, sizeof(std::uint8_t), 1, _file) == 1; return std::fwrite(&value, sizeof(std::uint8_t), 1, _file) == 1;
} }
bool bool
BinaryWriter::writeInt16(std::int16_t value) { Writer::writeInt16(std::int16_t value) {
return std::fwrite(&value, sizeof(std::int16_t), 1, _file) == 1; return std::fwrite(&value, sizeof(std::int16_t), 1, _file) == 1;
} }
bool bool
BinaryWriter::writeUint16(std::uint16_t value) { Writer::writeUint16(std::uint16_t value) {
return std::fwrite(&value, sizeof(std::uint16_t), 1, _file) == 1; return std::fwrite(&value, sizeof(std::uint16_t), 1, _file) == 1;
} }
bool bool
BinaryWriter::writeInt32(std::int32_t value) { Writer::writeInt32(std::int32_t value) {
return std::fwrite(&value, sizeof(std::int32_t), 1, _file) == 1; return std::fwrite(&value, sizeof(std::int32_t), 1, _file) == 1;
} }
bool bool
BinaryWriter::writeUint32(std::uint32_t value) { Writer::writeUint32(std::uint32_t value) {
return std::fwrite(&value, sizeof(std::uint32_t), 1, _file) == 1; return std::fwrite(&value, sizeof(std::uint32_t), 1, _file) == 1;
} }
bool bool
BinaryWriter::writeInt64(std::int64_t value) { Writer::writeInt64(std::int64_t value) {
return std::fwrite(&value, sizeof(std::int64_t), 1, _file) == 1; return std::fwrite(&value, sizeof(std::int64_t), 1, _file) == 1;
} }
bool bool
BinaryWriter::writeUint64(std::uint64_t value) { Writer::writeUint64(std::uint64_t value) {
return std::fwrite(&value, sizeof(std::uint64_t), 1, _file) == 1; return std::fwrite(&value, sizeof(std::uint64_t), 1, _file) == 1;
} }
bool bool
BinaryWriter::writeFloat(float value) { Writer::writeFloat(float value) {
return std::fwrite(&value, sizeof(float), 1, _file) == 1; return std::fwrite(&value, sizeof(float), 1, _file) == 1;
} }
bool bool
BinaryWriter::writeDouble(double value) { Writer::writeDouble(double value) {
return std::fwrite(&value, sizeof(double), 1, _file) == 1; return std::fwrite(&value, sizeof(double), 1, _file) == 1;
} }
bool bool
BinaryWriter::writeArray(Containers::ArrayView<const char> array) { Writer::writeArray(Containers::ArrayView<const char> array) {
if(array.isEmpty()) { if(array.isEmpty()) {
return false; return false;
} }
@ -136,7 +136,7 @@ BinaryWriter::writeArray(Containers::ArrayView<const char> array) {
} }
bool bool
BinaryWriter::writeUEString(Containers::StringView str) { Writer::writeUEString(Containers::StringView str) {
if(str.size() > UINT32_MAX) { if(str.size() > UINT32_MAX) {
LOG_ERROR_FORMAT("String is too big. Expected size() < UINT32_MAX, got {} instead.", str.size()); LOG_ERROR_FORMAT("String is too big. Expected size() < UINT32_MAX, got {} instead.", str.size());
return false; return false;
@ -154,7 +154,7 @@ BinaryWriter::writeUEString(Containers::StringView str) {
} }
std::size_t std::size_t
BinaryWriter::writeUEStringToArray(Containers::StringView value) { Writer::writeUEStringToArray(Containers::StringView value) {
return writeValueToArray<std::uint32_t>(std::uint32_t(value.size()) + 1u) + return writeValueToArray<std::uint32_t>(std::uint32_t(value.size()) + 1u) +
writeDataToArray(Containers::ArrayView<const char>{value}) + writeDataToArray(Containers::ArrayView<const char>{value}) +
writeValueToArray<char>('\0'); writeValueToArray<char>('\0');

View file

@ -26,18 +26,18 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas { namespace BinaryIo {
class BinaryWriter { class Writer {
public: public:
explicit BinaryWriter(Containers::StringView filename); explicit Writer(Containers::StringView filename);
~BinaryWriter(); ~Writer();
BinaryWriter(const BinaryWriter& other) = delete; Writer(const Writer& other) = delete;
BinaryWriter& operator=(const BinaryWriter& other) = delete; Writer& operator=(const Writer& other) = delete;
BinaryWriter(BinaryWriter&& other) = default; Writer(Writer&& other) = default;
BinaryWriter& operator=(BinaryWriter&& other) = default; Writer& operator=(Writer&& other) = default;
bool open(); bool open();

View file

@ -44,6 +44,14 @@ set(Logger_SOURCES
Logger/MagnumLogBuffer.cpp Logger/MagnumLogBuffer.cpp
) )
set(BinaryIo_SOURCES
BinaryIo/BinaryIo.h
BinaryIo/Reader.h
BinaryIo/Reader.cpp
BinaryIo/Writer.h
BinaryIo/Writer.cpp
)
set(Gvas_SOURCES set(Gvas_SOURCES
Gvas/Serialisers/Serialisers.h Gvas/Serialisers/Serialisers.h
Gvas/Serialisers/AbstractUnrealCollectionProperty.h Gvas/Serialisers/AbstractUnrealCollectionProperty.h
@ -189,6 +197,7 @@ add_executable(MassBuilderSaveTool
FontAwesome/IconsFontAwesome5.h FontAwesome/IconsFontAwesome5.h
FontAwesome/IconsFontAwesome5Brands.h FontAwesome/IconsFontAwesome5Brands.h
${Logger_SOURCES} ${Logger_SOURCES}
${BinaryIo_SOURCES}
${Gvas_SOURCES} ${Gvas_SOURCES}
${SAVETOOL_RC_FILE} ${SAVETOOL_RC_FILE}
${Assets} ${Assets}

View file

@ -19,8 +19,8 @@
#include "../Logger/Logger.h" #include "../Logger/Logger.h"
#include "BinaryReader.h" #include "../BinaryIo/Reader.h"
#include "BinaryWriter.h" #include "../BinaryIo/Writer.h"
#include "File.h" #include "File.h"
@ -87,7 +87,7 @@ File::saveToFile() {
return false; return false;
} }
BinaryWriter writer{_filepath + ".tmp"_s}; BinaryIo::Writer writer{_filepath + ".tmp"_s};
if(!writer.open()) { if(!writer.open()) {
_lastError = "Couldn't open the file for saving."_s; _lastError = "Couldn't open the file for saving."_s;
@ -175,7 +175,7 @@ File::loadData() {
return; return;
} }
BinaryReader reader{_filepath}; BinaryIo::Reader reader{_filepath};
if(!reader.open()) { if(!reader.open()) {
_lastError = _filepath + " couldn't be opened."_s; _lastError = _filepath + " couldn't be opened."_s;

View file

@ -18,8 +18,6 @@
namespace Gvas { namespace Gvas {
class BinaryReader;
class BinaryWriter;
class File; class File;
class PropertySerialiser; class PropertySerialiser;

View file

@ -39,8 +39,8 @@
#include "Types/NoneProperty.h" #include "Types/NoneProperty.h"
#include "BinaryReader.h" #include "../BinaryIo/Reader.h"
#include "BinaryWriter.h" #include "../BinaryIo/Writer.h"
#include "PropertySerialiser.h" #include "PropertySerialiser.h"
@ -76,7 +76,7 @@ PropertySerialiser::instance() {
} }
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
PropertySerialiser::read(BinaryReader& reader) { PropertySerialiser::read(BinaryIo::Reader& reader) {
if(reader.peekChar() < 0 || reader.eof()) { if(reader.peekChar() < 0 || reader.eof()) {
return nullptr; return nullptr;
} }
@ -104,7 +104,7 @@ PropertySerialiser::read(BinaryReader& reader) {
} }
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
PropertySerialiser::readItem(BinaryReader& reader, Containers::String type, std::size_t value_length, PropertySerialiser::readItem(BinaryIo::Reader& reader, Containers::String type, std::size_t value_length,
Containers::String name) Containers::String name)
{ {
if(reader.peekChar() < 0 || reader.eof()) { if(reader.peekChar() < 0 || reader.eof()) {
@ -115,7 +115,7 @@ PropertySerialiser::readItem(BinaryReader& reader, Containers::String type, std:
} }
Containers::Array<Types::UnrealPropertyBase::ptr> Containers::Array<Types::UnrealPropertyBase::ptr>
PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView item_type, std::uint32_t count) { PropertySerialiser::readSet(BinaryIo::Reader& reader, Containers::StringView item_type, std::uint32_t count) {
if(reader.peekChar() < 0 || reader.eof()) { if(reader.peekChar() < 0 || reader.eof()) {
return nullptr; return nullptr;
} }
@ -160,7 +160,7 @@ PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView item_ty
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
PropertySerialiser::deserialise(Containers::String name, Containers::String type, std::size_t value_length, PropertySerialiser::deserialise(Containers::String name, Containers::String type, std::size_t value_length,
BinaryReader& reader) BinaryIo::Reader& reader)
{ {
Types::UnrealPropertyBase::ptr prop; Types::UnrealPropertyBase::ptr prop;
auto serialiser = getSerialiser(type); auto serialiser = getSerialiser(type);
@ -183,7 +183,7 @@ PropertySerialiser::deserialise(Containers::String name, Containers::String type
} }
bool PropertySerialiser::serialise(Types::UnrealPropertyBase::ptr& prop, Containers::StringView item_type, bool PropertySerialiser::serialise(Types::UnrealPropertyBase::ptr& prop, Containers::StringView item_type,
std::size_t& bytes_written, BinaryWriter& writer) std::size_t& bytes_written, BinaryIo::Writer& writer)
{ {
auto serialiser = getSerialiser(item_type); auto serialiser = getSerialiser(item_type);
if(!serialiser) { if(!serialiser) {
@ -193,7 +193,7 @@ bool PropertySerialiser::serialise(Types::UnrealPropertyBase::ptr& prop, Contain
} }
bool bool
PropertySerialiser::write(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer) { PropertySerialiser::write(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer) {
if(prop->name == "None" && prop->propertyType == "NoneProperty" && dynamic_cast<Types::NoneProperty*>(prop.get())) { if(prop->name == "None" && prop->propertyType == "NoneProperty" && dynamic_cast<Types::NoneProperty*>(prop.get())) {
bytes_written += writer.writeUEStringToArray(*prop->name); bytes_written += writer.writeUEStringToArray(*prop->name);
return true; return true;
@ -218,7 +218,7 @@ PropertySerialiser::write(Types::UnrealPropertyBase::ptr& prop, std::size_t& byt
bool bool
PropertySerialiser::writeItem(Types::UnrealPropertyBase::ptr& prop, Containers::StringView item_type, PropertySerialiser::writeItem(Types::UnrealPropertyBase::ptr& prop, Containers::StringView item_type,
std::size_t& bytes_written, BinaryWriter& writer) std::size_t& bytes_written, BinaryIo::Writer& writer)
{ {
if(prop->name == "None" && prop->propertyType == "NoneProperty" && dynamic_cast<Types::NoneProperty*>(prop.get())) { if(prop->name == "None" && prop->propertyType == "NoneProperty" && dynamic_cast<Types::NoneProperty*>(prop.get())) {
bytes_written += writer.writeUEStringToArray(*prop->name); bytes_written += writer.writeUEStringToArray(*prop->name);
@ -229,7 +229,8 @@ PropertySerialiser::writeItem(Types::UnrealPropertyBase::ptr& prop, Containers::
} }
bool PropertySerialiser::writeSet(Containers::ArrayView<Types::UnrealPropertyBase::ptr> props, bool PropertySerialiser::writeSet(Containers::ArrayView<Types::UnrealPropertyBase::ptr> props,
Containers::StringView item_type, std::size_t& bytes_written, BinaryWriter& writer) Containers::StringView item_type, std::size_t& bytes_written,
BinaryIo::Writer& writer)
{ {
auto serialiser = getCollectionSerialiser(item_type); auto serialiser = getCollectionSerialiser(item_type);
if(serialiser) { if(serialiser) {

View file

@ -25,7 +25,7 @@
#include "Types/UnrealPropertyBase.h" #include "Types/UnrealPropertyBase.h"
#include "Gvas.h" #include "../BinaryIo/BinaryIo.h"
using namespace Corrade; using namespace Corrade;
@ -35,21 +35,21 @@ class PropertySerialiser {
public: public:
static auto instance() -> PropertySerialiser&; static auto instance() -> PropertySerialiser&;
auto read(BinaryReader& reader) -> Types::UnrealPropertyBase::ptr; auto read(BinaryIo::Reader& reader) -> Types::UnrealPropertyBase::ptr;
auto readItem(BinaryReader& reader, Containers::String type, std::size_t value_length, Containers::String name) auto readItem(BinaryIo::Reader& reader, Containers::String type, std::size_t value_length, Containers::String name)
-> Types::UnrealPropertyBase::ptr; -> Types::UnrealPropertyBase::ptr;
auto readSet(BinaryReader& reader, Containers::StringView item_type, std::uint32_t count) auto readSet(BinaryIo::Reader& reader, Containers::StringView item_type, std::uint32_t count)
-> Containers::Array<Types::UnrealPropertyBase::ptr>; -> Containers::Array<Types::UnrealPropertyBase::ptr>;
auto deserialise(Containers::String name, Containers::String type, std::size_t value_length, auto deserialise(Containers::String name, Containers::String type, std::size_t value_length,
BinaryReader& reader) -> Types::UnrealPropertyBase::ptr; BinaryIo::Reader& reader) -> Types::UnrealPropertyBase::ptr;
bool serialise(Types::UnrealPropertyBase::ptr& prop, Containers::StringView item_type, bool serialise(Types::UnrealPropertyBase::ptr& prop, Containers::StringView item_type,
std::size_t& bytes_written, BinaryWriter& writer); std::size_t& bytes_written, BinaryIo::Writer& writer);
bool write(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer); bool write(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer);
bool writeItem(Types::UnrealPropertyBase::ptr& prop, Containers::StringView item_type, bool writeItem(Types::UnrealPropertyBase::ptr& prop, Containers::StringView item_type,
std::size_t& bytes_written, BinaryWriter& writer); std::size_t& bytes_written, BinaryIo::Writer& writer);
bool writeSet(Containers::ArrayView<Types::UnrealPropertyBase::ptr> props, Containers::StringView item_type, bool writeSet(Containers::ArrayView<Types::UnrealPropertyBase::ptr> props, Containers::StringView item_type,
std::size_t& bytes_written, BinaryWriter& writer); std::size_t& bytes_written, BinaryIo::Writer& writer);
private: private:
PropertySerialiser(); PropertySerialiser();

View file

@ -22,6 +22,7 @@
#include <Corrade/Containers/StringView.h> #include <Corrade/Containers/StringView.h>
#include "../Gvas.h" #include "../Gvas.h"
#include "../../BinaryIo/BinaryIo.h"
#include "../Types/UnrealPropertyBase.h" #include "../Types/UnrealPropertyBase.h"
using namespace Corrade; using namespace Corrade;
@ -41,11 +42,12 @@ class AbstractUnrealCollectionProperty {
virtual auto types() -> StringArrayView = 0; virtual auto types() -> StringArrayView = 0;
virtual auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, virtual auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
std::uint32_t count, BinaryReader& reader, PropertySerialiser& serialiser) std::uint32_t count, BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> PropertyArray = 0; -> PropertyArray = 0;
virtual bool serialise(PropertyArrayView props, Containers::StringView item_type, virtual bool serialise(PropertyArrayView props, Containers::StringView item_type,
std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) = 0; std::size_t& bytes_written, BinaryIo::Writer& writer,
PropertySerialiser& serialiser) = 0;
}; };
}} }}

View file

@ -21,11 +21,11 @@
#include <Corrade/Containers/StringView.h> #include <Corrade/Containers/StringView.h>
#include "../Gvas.h" #include "../Gvas.h"
#include "../../BinaryIo/BinaryIo.h"
#include "../Types/UnrealPropertyBase.h" #include "../Types/UnrealPropertyBase.h"
using namespace Corrade; using namespace Corrade;
namespace Gvas { namespace Serialisers { namespace Gvas { namespace Serialisers {
using StringArrayView = Containers::ArrayView<const Containers::String>; using StringArrayView = Containers::ArrayView<const Containers::String>;
@ -39,11 +39,11 @@ class AbstractUnrealProperty {
virtual auto types() -> StringArrayView = 0; virtual auto types() -> StringArrayView = 0;
virtual auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, virtual auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr = 0; -> Types::UnrealPropertyBase::ptr = 0;
virtual bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, virtual bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
PropertySerialiser& serialiser) = 0; BinaryIo::Writer& writer, PropertySerialiser& serialiser) = 0;
}; };
}} }}

View file

@ -22,6 +22,7 @@
#include <Corrade/Containers/StringView.h> #include <Corrade/Containers/StringView.h>
#include "../Gvas.h" #include "../Gvas.h"
#include "../../BinaryIo/BinaryIo.h"
#include "../Types/UnrealPropertyBase.h" #include "../Types/UnrealPropertyBase.h"
using namespace Corrade; using namespace Corrade;
@ -36,9 +37,9 @@ class AbstractUnrealStruct {
virtual bool supportsType(Containers::StringView type) = 0; virtual bool supportsType(Containers::StringView type) = 0;
virtual auto deserialise(BinaryReader& reader) -> Types::UnrealPropertyBase::ptr = 0; virtual auto deserialise(BinaryIo::Reader& reader) -> Types::UnrealPropertyBase::ptr = 0;
virtual bool serialise(Types::UnrealPropertyBase::ptr& structProp, BinaryWriter& writer, virtual bool serialise(Types::UnrealPropertyBase::ptr& structProp, BinaryIo::Writer& writer,
std::size_t& bytes_written) = 0; std::size_t& bytes_written) = 0;
}; };

View file

@ -16,8 +16,8 @@
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>
#include "../BinaryReader.h" #include "../../BinaryIo/Reader.h"
#include "../BinaryWriter.h" #include "../../BinaryIo/Writer.h"
#include "../PropertySerialiser.h" #include "../PropertySerialiser.h"
#include "../../Logger/Logger.h" #include "../../Logger/Logger.h"
@ -27,7 +27,7 @@ namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
ArrayProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, ArrayProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
{ {
Containers::String item_type; Containers::String item_type;
if(!reader.readUEString(item_type)) { if(!reader.readUEString(item_type)) {
@ -55,8 +55,8 @@ ArrayProperty::deserialiseProperty(Containers::StringView name, Containers::Stri
} }
bool bool
ArrayProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, ArrayProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
PropertySerialiser& serialiser) BinaryIo::Writer& writer, PropertySerialiser& serialiser)
{ {
auto array_prop = dynamic_cast<Types::ArrayProperty*>(prop.get()); auto array_prop = dynamic_cast<Types::ArrayProperty*>(prop.get());
if(!array_prop) { if(!array_prop) {

View file

@ -32,10 +32,10 @@ class ArrayProperty : public UnrealProperty<Types::ArrayProperty> {
private: private:
auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr override; -> Types::UnrealPropertyBase::ptr override;
bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
}} }}

View file

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "../BinaryReader.h" #include "../../BinaryIo/Reader.h"
#include "../BinaryWriter.h" #include "../../BinaryIo/Writer.h"
#include "../../Logger/Logger.h" #include "../../Logger/Logger.h"
#include "BoolProperty.h" #include "BoolProperty.h"
@ -31,7 +31,7 @@ BoolProperty::types() {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
BoolProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, BoolProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
{ {
if(value_length != 0) { if(value_length != 0) {
LOG_ERROR_FORMAT("Invalid value length for bool property {}. Expected 0, got {} instead.", name, value_length); LOG_ERROR_FORMAT("Invalid value length for bool property {}. Expected 0, got {} instead.", name, value_length);
@ -56,7 +56,7 @@ BoolProperty::deserialise(Containers::StringView name, Containers::StringView ty
} }
bool bool
BoolProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, BoolProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer,
PropertySerialiser& serialiser) PropertySerialiser& serialiser)
{ {
auto bool_prop = dynamic_cast<Types::BoolProperty*>(prop.get()); auto bool_prop = dynamic_cast<Types::BoolProperty*>(prop.get());

View file

@ -34,10 +34,10 @@ class BoolProperty : public AbstractUnrealProperty {
auto types() -> StringArrayView override; auto types() -> StringArrayView override;
auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr override; -> Types::UnrealPropertyBase::ptr override;
bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer,
PropertySerialiser& serialiser) override; PropertySerialiser& serialiser) override;
}; };

View file

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "../BinaryReader.h" #include "../../BinaryIo/Reader.h"
#include "../BinaryWriter.h" #include "../../BinaryIo/Writer.h"
#include "../../Logger/Logger.h" #include "../../Logger/Logger.h"
#include "ByteProperty.h" #include "ByteProperty.h"
@ -31,7 +31,7 @@ ByteProperty::types() {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
ByteProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, ByteProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
{ {
auto prop = Containers::pointer<Types::ByteProperty>(); auto prop = Containers::pointer<Types::ByteProperty>();
@ -68,7 +68,7 @@ ByteProperty::deserialise(Containers::StringView name, Containers::StringView ty
} }
bool bool
ByteProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, ByteProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer,
PropertySerialiser& serialiser) PropertySerialiser& serialiser)
{ {
auto byte_prop = dynamic_cast<Types::ByteProperty*>(prop.get()); auto byte_prop = dynamic_cast<Types::ByteProperty*>(prop.get());

View file

@ -32,10 +32,10 @@ class ByteProperty : public AbstractUnrealProperty {
auto types() -> StringArrayView override; auto types() -> StringArrayView override;
auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr override; -> Types::UnrealPropertyBase::ptr override;
bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer,
PropertySerialiser& serialiser) override; PropertySerialiser& serialiser) override;
}; };

View file

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "../BinaryReader.h" #include "../../BinaryIo/Reader.h"
#include "../BinaryWriter.h" #include "../../BinaryIo/Writer.h"
#include "../../Logger/Logger.h" #include "../../Logger/Logger.h"
#include "ColourProperty.h" #include "ColourProperty.h"
@ -24,7 +24,7 @@ namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
ColourProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, ColourProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
{ {
auto prop = Containers::pointer<Types::ColourStructProperty>(); auto prop = Containers::pointer<Types::ColourStructProperty>();
@ -40,7 +40,7 @@ ColourProperty::deserialiseProperty(Containers::StringView name, Containers::Str
bool bool
ColourProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, ColourProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
BinaryWriter& writer, PropertySerialiser& serialiser) BinaryIo::Writer& writer, PropertySerialiser& serialiser)
{ {
auto colour_prop = dynamic_cast<Types::ColourStructProperty*>(prop.get()); auto colour_prop = dynamic_cast<Types::ColourStructProperty*>(prop.get());
if(!colour_prop) { if(!colour_prop) {

View file

@ -32,10 +32,10 @@ class ColourProperty : public UnrealProperty<Types::ColourStructProperty> {
private: private:
auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr override; -> Types::UnrealPropertyBase::ptr override;
bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
}} }}

View file

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "../BinaryReader.h" #include "../../BinaryIo/Reader.h"
#include "../BinaryWriter.h" #include "../../BinaryIo/Writer.h"
#include "../../Logger/Logger.h" #include "../../Logger/Logger.h"
#include "DateTimeProperty.h" #include "DateTimeProperty.h"
@ -24,7 +24,7 @@ namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
DateTimeProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, DateTimeProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type,
std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) std::size_t value_length, BinaryIo::Reader& reader, PropertySerialiser& serialiser)
{ {
auto prop = Containers::pointer<Types::DateTimeStructProperty>(); auto prop = Containers::pointer<Types::DateTimeStructProperty>();
@ -38,7 +38,7 @@ DateTimeProperty::deserialiseProperty(Containers::StringView name, Containers::S
bool bool
DateTimeProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, DateTimeProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
BinaryWriter& writer, PropertySerialiser& serialiser) BinaryIo::Writer& writer, PropertySerialiser& serialiser)
{ {
auto dt_prop = dynamic_cast<Types::DateTimeStructProperty*>(prop.get()); auto dt_prop = dynamic_cast<Types::DateTimeStructProperty*>(prop.get());
if(!dt_prop) { if(!dt_prop) {

View file

@ -30,10 +30,10 @@ class DateTimeProperty : public UnrealProperty<Types::DateTimeStructProperty> {
private: private:
auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr override; -> Types::UnrealPropertyBase::ptr override;
bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
}} }}

View file

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "../BinaryReader.h" #include "../../BinaryIo/Reader.h"
#include "../BinaryWriter.h" #include "../../BinaryIo/Writer.h"
#include "../../Logger/Logger.h" #include "../../Logger/Logger.h"
#include "EnumProperty.h" #include "EnumProperty.h"
@ -31,7 +31,7 @@ EnumProperty::types() {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
EnumProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, EnumProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
{ {
auto prop = Containers::pointer<Types::EnumProperty>(); auto prop = Containers::pointer<Types::EnumProperty>();
@ -55,7 +55,7 @@ EnumProperty::deserialise(Containers::StringView name, Containers::StringView ty
} }
bool bool
EnumProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, EnumProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer,
PropertySerialiser& serialiser) PropertySerialiser& serialiser)
{ {
auto enum_prop = dynamic_cast<Types::EnumProperty*>(prop.get()); auto enum_prop = dynamic_cast<Types::EnumProperty*>(prop.get());

View file

@ -32,10 +32,10 @@ class EnumProperty : public AbstractUnrealProperty {
auto types() -> StringArrayView override; auto types() -> StringArrayView override;
auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr override; -> Types::UnrealPropertyBase::ptr override;
bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer,
PropertySerialiser& serialiser) override; PropertySerialiser& serialiser) override;
}; };

View file

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "../BinaryReader.h" #include "../../BinaryIo/Reader.h"
#include "../BinaryWriter.h" #include "../../BinaryIo/Writer.h"
#include "../../Logger/Logger.h" #include "../../Logger/Logger.h"
#include "FloatProperty.h" #include "FloatProperty.h"
@ -31,7 +31,7 @@ FloatProperty::types() {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
FloatProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, FloatProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
{ {
auto prop = Containers::pointer<Types::FloatProperty>(); auto prop = Containers::pointer<Types::FloatProperty>();
@ -50,7 +50,7 @@ FloatProperty::deserialise(Containers::StringView name, Containers::StringView t
} }
bool bool
FloatProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, FloatProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer,
PropertySerialiser& serialiser) PropertySerialiser& serialiser)
{ {
auto float_prop = dynamic_cast<Types::FloatProperty*>(prop.get()); auto float_prop = dynamic_cast<Types::FloatProperty*>(prop.get());

View file

@ -32,10 +32,10 @@ class FloatProperty : public AbstractUnrealProperty {
auto types() -> StringArrayView override; auto types() -> StringArrayView override;
auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr override; -> Types::UnrealPropertyBase::ptr override;
bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer,
PropertySerialiser& serialiser) override; PropertySerialiser& serialiser) override;
}; };

View file

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "../BinaryReader.h" #include "../../BinaryIo/Reader.h"
#include "../BinaryWriter.h" #include "../../BinaryIo/Writer.h"
#include "../../Logger/Logger.h" #include "../../Logger/Logger.h"
#include "GuidProperty.h" #include "GuidProperty.h"
@ -26,7 +26,7 @@ namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
GuidProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, GuidProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
{ {
auto prop = Containers::pointer<Types::GuidStructProperty>(); auto prop = Containers::pointer<Types::GuidStructProperty>();
@ -39,8 +39,8 @@ GuidProperty::deserialiseProperty(Containers::StringView name, Containers::Strin
} }
bool bool
GuidProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, GuidProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
PropertySerialiser& serialiser) BinaryIo::Writer& writer, PropertySerialiser& serialiser)
{ {
auto guid_prop = dynamic_cast<Types::GuidStructProperty*>(prop.get()); auto guid_prop = dynamic_cast<Types::GuidStructProperty*>(prop.get());
if(!guid_prop) { if(!guid_prop) {

View file

@ -30,10 +30,10 @@ class GuidProperty : public UnrealProperty<Types::GuidStructProperty> {
private: private:
auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr override; -> Types::UnrealPropertyBase::ptr override;
bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
}} }}

View file

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "../BinaryReader.h" #include "../../BinaryIo/Reader.h"
#include "../BinaryWriter.h" #include "../../BinaryIo/Writer.h"
#include "../../Logger/Logger.h" #include "../../Logger/Logger.h"
#include "IntProperty.h" #include "IntProperty.h"
@ -24,7 +24,7 @@ namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
IntProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, IntProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
{ {
auto prop = Containers::pointer<Types::IntProperty>(); auto prop = Containers::pointer<Types::IntProperty>();
@ -55,8 +55,8 @@ IntProperty::deserialiseProperty(Containers::StringView name, Containers::String
} }
bool bool
IntProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, IntProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
PropertySerialiser& serialiser) BinaryIo::Writer& writer, PropertySerialiser& serialiser)
{ {
auto int_prop = dynamic_cast<Types::IntProperty*>(prop.get()); auto int_prop = dynamic_cast<Types::IntProperty*>(prop.get());
if(!int_prop) { if(!int_prop) {

View file

@ -30,10 +30,10 @@ class IntProperty : public UnrealProperty<Types::IntProperty> {
private: private:
auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr override; -> Types::UnrealPropertyBase::ptr override;
bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
}} }}

View file

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "../BinaryReader.h" #include "../../BinaryIo/Reader.h"
#include "../BinaryWriter.h" #include "../../BinaryIo/Writer.h"
#include "../PropertySerialiser.h" #include "../PropertySerialiser.h"
#include "../Types/NoneProperty.h" #include "../Types/NoneProperty.h"
#include "../../Logger/Logger.h" #include "../../Logger/Logger.h"
@ -28,7 +28,7 @@ namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
MapProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, MapProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
{ {
auto prop = Containers::pointer<Types::MapProperty>(); auto prop = Containers::pointer<Types::MapProperty>();
@ -110,8 +110,8 @@ MapProperty::deserialiseProperty(Containers::StringView name, Containers::String
} }
bool bool
MapProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, MapProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
PropertySerialiser& serialiser) BinaryIo::Writer& writer, PropertySerialiser& serialiser)
{ {
auto map_prop = dynamic_cast<Types::MapProperty*>(prop.get()); auto map_prop = dynamic_cast<Types::MapProperty*>(prop.get());
if(!map_prop) { if(!map_prop) {

View file

@ -30,10 +30,10 @@ class MapProperty : public UnrealProperty<Types::MapProperty> {
private: private:
auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr override; -> Types::UnrealPropertyBase::ptr override;
bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
}} }}

View file

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "../BinaryReader.h" #include "../../BinaryIo/Reader.h"
#include "../BinaryWriter.h" #include "../../BinaryIo/Writer.h"
#include "../PropertySerialiser.h" #include "../PropertySerialiser.h"
#include "../Types/IntProperty.h" #include "../Types/IntProperty.h"
#include "../Types/NoneProperty.h" #include "../Types/NoneProperty.h"
@ -29,7 +29,8 @@ namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
ResourceProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, ResourceProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type,
std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) std::size_t value_length, BinaryIo::Reader& reader,
PropertySerialiser& serialiser)
{ {
auto prop = Containers::pointer<Types::ResourceItemValue>(); auto prop = Containers::pointer<Types::ResourceItemValue>();
@ -81,7 +82,7 @@ ResourceProperty::deserialiseProperty(Containers::StringView name, Containers::S
bool bool
ResourceProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, ResourceProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
BinaryWriter& writer, PropertySerialiser& serialiser) BinaryIo::Writer& writer, PropertySerialiser& serialiser)
{ {
auto res_prop = dynamic_cast<Types::ResourceItemValue*>(prop.get()); auto res_prop = dynamic_cast<Types::ResourceItemValue*>(prop.get());
if(!res_prop) { if(!res_prop) {

View file

@ -30,10 +30,10 @@ class ResourceProperty : public UnrealProperty<Types::ResourceItemValue> {
private: private:
auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr override; -> Types::UnrealPropertyBase::ptr override;
bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
}} }}

View file

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "../BinaryReader.h" #include "../../BinaryIo/Reader.h"
#include "../BinaryWriter.h" #include "../../BinaryIo/Writer.h"
#include "../../Logger/Logger.h" #include "../../Logger/Logger.h"
#include "RotatorProperty.h" #include "RotatorProperty.h"
@ -24,7 +24,7 @@ namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
RotatorProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, RotatorProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
{ {
auto prop = Containers::pointer<Types::RotatorStructProperty>(); auto prop = Containers::pointer<Types::RotatorStructProperty>();
@ -38,7 +38,7 @@ RotatorProperty::deserialiseProperty(Containers::StringView name, Containers::St
bool bool
RotatorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, RotatorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
BinaryWriter& writer, PropertySerialiser& serialiser) BinaryIo::Writer& writer, PropertySerialiser& serialiser)
{ {
auto rotator = dynamic_cast<Types::RotatorStructProperty*>(prop.get()); auto rotator = dynamic_cast<Types::RotatorStructProperty*>(prop.get());
if(!rotator) { if(!rotator) {
@ -46,7 +46,8 @@ RotatorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::si
return false; return false;
} }
bytes_written += writer.writeValueToArray<float>(rotator->x) + writer.writeValueToArray<float>(rotator->y) + bytes_written += writer.writeValueToArray<float>(rotator->x) +
writer.writeValueToArray<float>(rotator->y) +
writer.writeValueToArray<float>(rotator->z); writer.writeValueToArray<float>(rotator->z);
return true; return true;

View file

@ -30,10 +30,10 @@ class RotatorProperty : public UnrealProperty<Types::RotatorStructProperty> {
private: private:
auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr override; -> Types::UnrealPropertyBase::ptr override;
bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
}} }}

View file

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "../BinaryReader.h" #include "../../BinaryIo/Reader.h"
#include "../BinaryWriter.h" #include "../../BinaryIo/Writer.h"
#include "../PropertySerialiser.h" #include "../PropertySerialiser.h"
#include "../../Logger/Logger.h" #include "../../Logger/Logger.h"
@ -25,7 +25,7 @@ namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
SetProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, SetProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
{ {
Containers::String item_type; Containers::String item_type;
if(!reader.readUEString(item_type)) { if(!reader.readUEString(item_type)) {
@ -59,8 +59,8 @@ SetProperty::deserialiseProperty(Containers::StringView name, Containers::String
} }
bool bool
SetProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, SetProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
PropertySerialiser& serialiser) BinaryIo::Writer& writer, PropertySerialiser& serialiser)
{ {
auto set_prop = dynamic_cast<Types::SetProperty*>(prop.get()); auto set_prop = dynamic_cast<Types::SetProperty*>(prop.get());
if(!set_prop) { if(!set_prop) {

View file

@ -30,10 +30,10 @@ class SetProperty : public UnrealProperty<Types::SetProperty> {
private: private:
auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr override; -> Types::UnrealPropertyBase::ptr override;
bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
}} }}

View file

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "../BinaryReader.h" #include "../../BinaryIo/Reader.h"
#include "../BinaryWriter.h" #include "../../BinaryIo/Writer.h"
#include "../../Logger/Logger.h" #include "../../Logger/Logger.h"
#include "StringProperty.h" #include "StringProperty.h"
@ -33,7 +33,7 @@ StringProperty::types() {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
StringProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, StringProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
{ {
auto prop = Containers::pointer<Types::StringProperty>(type); auto prop = Containers::pointer<Types::StringProperty>(type);
@ -56,7 +56,7 @@ StringProperty::deserialise(Containers::StringView name, Containers::StringView
} }
bool bool
StringProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, StringProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer,
PropertySerialiser& serialiser) PropertySerialiser& serialiser)
{ {
auto str_prop = dynamic_cast<Types::StringProperty*>(prop.get()); auto str_prop = dynamic_cast<Types::StringProperty*>(prop.get());

View file

@ -32,10 +32,10 @@ class StringProperty : public AbstractUnrealProperty {
auto types() -> StringArrayView override; auto types() -> StringArrayView override;
auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr override; -> Types::UnrealPropertyBase::ptr override;
bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer,
PropertySerialiser& serialiser) override; PropertySerialiser& serialiser) override;
}; };

View file

@ -16,8 +16,8 @@
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>
#include "../BinaryReader.h" #include "../../BinaryIo/Reader.h"
#include "../BinaryWriter.h" #include "../../BinaryIo/Writer.h"
#include "../PropertySerialiser.h" #include "../PropertySerialiser.h"
#include "../Types/GenericStructProperty.h" #include "../Types/GenericStructProperty.h"
#include "../Types/NoneProperty.h" #include "../Types/NoneProperty.h"
@ -36,7 +36,7 @@ Struct::types() {
PropertyArray PropertyArray
Struct::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, Struct::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
std::uint32_t count, BinaryReader& reader, PropertySerialiser& serialiser) std::uint32_t count, BinaryIo::Reader& reader, PropertySerialiser& serialiser)
{ {
Containers::String item_type; Containers::String item_type;
if(!reader.readUEString(item_type)) { if(!reader.readUEString(item_type)) {
@ -89,7 +89,7 @@ Struct::deserialise(Containers::StringView name, Containers::StringView type, st
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
Struct::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, Struct::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
{ {
Containers::String item_type; Containers::String item_type;
if(!reader.readUEString(item_type)) { if(!reader.readUEString(item_type)) {
@ -127,7 +127,7 @@ Struct::deserialise(Containers::StringView name, Containers::StringView type, st
bool bool
Struct::serialise(PropertyArrayView props, Containers::StringView item_type, std::size_t& bytes_written, Struct::serialise(PropertyArrayView props, Containers::StringView item_type, std::size_t& bytes_written,
BinaryWriter& writer, PropertySerialiser& serialiser) BinaryIo::Writer& writer, PropertySerialiser& serialiser)
{ {
bytes_written += writer.writeUEStringToArray(*(props.front()->name)); bytes_written += writer.writeUEStringToArray(*(props.front()->name));
bytes_written += writer.writeUEStringToArray(item_type); bytes_written += writer.writeUEStringToArray(item_type);
@ -170,7 +170,7 @@ Struct::serialise(PropertyArrayView props, Containers::StringView item_type, std
} }
bool bool
Struct::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, Struct::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer,
PropertySerialiser& serialiser) PropertySerialiser& serialiser)
{ {
auto struct_prop = dynamic_cast<Types::StructProperty*>(prop.get()); auto struct_prop = dynamic_cast<Types::StructProperty*>(prop.get());
@ -198,7 +198,7 @@ Struct::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_writt
Types::StructProperty::ptr Types::StructProperty::ptr
Struct::readStructValue(Containers::StringView name, Containers::StringView type, std::size_t value_length, Struct::readStructValue(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
{ {
static_cast<void>(value_length); static_cast<void>(value_length);
@ -223,7 +223,7 @@ Struct::readStructValue(Containers::StringView name, Containers::StringView type
} }
bool bool
Struct::writeStructValue(Types::StructProperty* prop, std::size_t& bytes_written, BinaryWriter& writer, Struct::writeStructValue(Types::StructProperty* prop, std::size_t& bytes_written, BinaryIo::Writer& writer,
PropertySerialiser& serialiser) PropertySerialiser& serialiser)
{ {
auto struct_prop = dynamic_cast<Types::GenericStructProperty*>(prop); auto struct_prop = dynamic_cast<Types::GenericStructProperty*>(prop);

View file

@ -34,21 +34,21 @@ class Struct : public AbstractUnrealProperty, public AbstractUnrealCollectionPro
auto types() -> StringArrayView override; auto types() -> StringArrayView override;
auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
std::uint32_t count, BinaryReader& reader, PropertySerialiser& serialiser) std::uint32_t count, BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> PropertyArray override; -> PropertyArray override;
auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr override; -> Types::UnrealPropertyBase::ptr override;
bool serialise(PropertyArrayView props, Containers::StringView item_type, std::size_t& bytes_written, bool serialise(PropertyArrayView props, Containers::StringView item_type, std::size_t& bytes_written,
BinaryWriter& writer, PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer,
PropertySerialiser& serialiser) override; PropertySerialiser& serialiser) override;
private: private:
auto readStructValue(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto readStructValue(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) -> Types::StructProperty::ptr; BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::StructProperty::ptr;
bool writeStructValue(Types::StructProperty* prop, std::size_t& bytes_written, BinaryWriter& writer, bool writeStructValue(Types::StructProperty* prop, std::size_t& bytes_written, BinaryIo::Writer& writer,
PropertySerialiser& serialiser); PropertySerialiser& serialiser);
}; };

View file

@ -18,8 +18,8 @@
#include "../../Logger/Logger.h" #include "../../Logger/Logger.h"
#include "../BinaryReader.h" #include "../../BinaryIo/Reader.h"
#include "../BinaryWriter.h" #include "../../BinaryIo/Writer.h"
#include "TextProperty.h" #include "TextProperty.h"
@ -27,7 +27,7 @@ namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
TextProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, TextProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
{ {
auto prop = Containers::pointer<Types::TextProperty>(); auto prop = Containers::pointer<Types::TextProperty>();
@ -73,8 +73,8 @@ TextProperty::deserialiseProperty(Containers::StringView name, Containers::Strin
} }
bool bool
TextProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, TextProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
PropertySerialiser& serialiser) BinaryIo::Writer& writer, PropertySerialiser& serialiser)
{ {
auto text_prop = dynamic_cast<Types::TextProperty*>(prop.get()); auto text_prop = dynamic_cast<Types::TextProperty*>(prop.get());
if(!text_prop) { if(!text_prop) {

View file

@ -30,10 +30,10 @@ class TextProperty : public UnrealProperty<Types::TextProperty> {
private: private:
auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr override; -> Types::UnrealPropertyBase::ptr override;
bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
}} }}

View file

@ -52,13 +52,13 @@ class UnrealProperty : public AbstractUnrealProperty {
} }
auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr override -> Types::UnrealPropertyBase::ptr override
{ {
return deserialiseProperty(name, type, value_length, reader, serialiser); return deserialiseProperty(name, type, value_length, reader, serialiser);
} }
bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer,
PropertySerialiser& serialiser) override PropertySerialiser& serialiser) override
{ {
return serialiseProperty(prop, bytes_written, writer, serialiser); return serialiseProperty(prop, bytes_written, writer, serialiser);
@ -66,11 +66,11 @@ class UnrealProperty : public AbstractUnrealProperty {
private: private:
virtual auto deserialiseProperty(Containers::StringView name, Containers::StringView type, virtual auto deserialiseProperty(Containers::StringView name, Containers::StringView type,
std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) std::size_t value_length, BinaryIo::Reader& reader,
-> Types::UnrealPropertyBase::ptr = 0; PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr = 0;
virtual bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, virtual bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
BinaryWriter& writer, PropertySerialiser& serialiser) = 0; BinaryIo::Writer& writer, PropertySerialiser& serialiser) = 0;
}; };
}} }}

View file

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "../BinaryReader.h" #include "../../BinaryIo/Reader.h"
#include "../BinaryWriter.h" #include "../../BinaryIo/Writer.h"
#include "../../Logger/Logger.h" #include "../../Logger/Logger.h"
#include "Vector2DProperty.h" #include "Vector2DProperty.h"
@ -24,7 +24,8 @@ namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
Vector2DProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, Vector2DProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type,
std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) std::size_t value_length, BinaryIo::Reader& reader,
PropertySerialiser& serialiser)
{ {
auto prop = Containers::pointer<Types::Vector2DStructProperty>(); auto prop = Containers::pointer<Types::Vector2DStructProperty>();
@ -38,7 +39,7 @@ Vector2DProperty::deserialiseProperty(Containers::StringView name, Containers::S
bool bool
Vector2DProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, Vector2DProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
BinaryWriter& writer, PropertySerialiser& serialiser) BinaryIo::Writer& writer, PropertySerialiser& serialiser)
{ {
auto vector = dynamic_cast<Types::Vector2DStructProperty*>(prop.get()); auto vector = dynamic_cast<Types::Vector2DStructProperty*>(prop.get());
if(!vector) { if(!vector) {
@ -46,7 +47,8 @@ Vector2DProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::s
return false; return false;
} }
bytes_written += writer.writeValueToArray<float>(vector->x) + writer.writeValueToArray<float>(vector->y); bytes_written += writer.writeValueToArray<float>(vector->x) +
writer.writeValueToArray<float>(vector->y);
return true; return true;
} }

View file

@ -30,10 +30,10 @@ class Vector2DProperty : public UnrealProperty<Types::Vector2DStructProperty> {
private: private:
auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr override; -> Types::UnrealPropertyBase::ptr override;
bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
}} }}

View file

@ -16,8 +16,8 @@
#include "../../Logger/Logger.h" #include "../../Logger/Logger.h"
#include "../BinaryReader.h" #include "../../BinaryIo/Reader.h"
#include "../BinaryWriter.h" #include "../../BinaryIo/Writer.h"
#include "VectorProperty.h" #include "VectorProperty.h"
@ -25,7 +25,7 @@ namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
VectorProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, VectorProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
{ {
auto prop = Containers::pointer<Types::VectorStructProperty>(); auto prop = Containers::pointer<Types::VectorStructProperty>();
@ -39,7 +39,7 @@ VectorProperty::deserialiseProperty(Containers::StringView name, Containers::Str
bool bool
VectorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, VectorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
BinaryWriter& writer, PropertySerialiser& serialiser) BinaryIo::Writer& writer, PropertySerialiser& serialiser)
{ {
auto vector = dynamic_cast<Types::VectorStructProperty*>(prop.get()); auto vector = dynamic_cast<Types::VectorStructProperty*>(prop.get());
if(!vector) { if(!vector) {
@ -47,7 +47,8 @@ VectorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::siz
return false; return false;
} }
bytes_written += writer.writeValueToArray<float>(vector->x) + writer.writeValueToArray<float>(vector->y) + bytes_written += writer.writeValueToArray<float>(vector->x) +
writer.writeValueToArray<float>(vector->y) +
writer.writeValueToArray<float>(vector->z); writer.writeValueToArray<float>(vector->z);
return true; return true;

View file

@ -30,10 +30,10 @@ class VectorProperty : public UnrealProperty<Types::VectorStructProperty> {
private: private:
auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryReader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
-> Types::UnrealPropertyBase::ptr override; -> Types::UnrealPropertyBase::ptr override;
bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
}} }}