2023-11-29 12:33:26 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// MassBuilderSaveTool
|
2024-03-08 20:25:32 +01:00
|
|
|
// Copyright (C) 2021-2024 Guillaume Jacquemin
|
2023-11-29 12:33:26 +01:00
|
|
|
//
|
|
|
|
// 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/>.
|
|
|
|
|
|
|
|
#include <Corrade/Containers/GrowableArray.h>
|
|
|
|
#include <Corrade/Containers/String.h>
|
|
|
|
#include <Corrade/Containers/StringView.h>
|
|
|
|
|
|
|
|
#include "Serialisers/AbstractUnrealProperty.h"
|
|
|
|
#include "Serialisers/AbstractUnrealCollectionProperty.h"
|
|
|
|
|
|
|
|
#include "Types/UnrealPropertyBase.h"
|
|
|
|
|
2024-03-08 21:18:17 +01:00
|
|
|
#include "../BinaryIo/BinaryIo.h"
|
2023-11-29 12:33:26 +01:00
|
|
|
|
|
|
|
using namespace Corrade;
|
|
|
|
|
|
|
|
namespace Gvas {
|
|
|
|
|
|
|
|
class PropertySerialiser {
|
|
|
|
public:
|
|
|
|
static auto instance() -> PropertySerialiser&;
|
|
|
|
|
2024-03-08 21:18:17 +01:00
|
|
|
auto read(BinaryIo::Reader& reader) -> Types::UnrealPropertyBase::ptr;
|
|
|
|
auto readItem(BinaryIo::Reader& reader, Containers::String type, std::size_t value_length, Containers::String name)
|
2023-11-29 12:33:26 +01:00
|
|
|
-> Types::UnrealPropertyBase::ptr;
|
2024-03-08 21:18:17 +01:00
|
|
|
auto readSet(BinaryIo::Reader& reader, Containers::StringView item_type, std::uint32_t count)
|
2023-11-29 12:33:26 +01:00
|
|
|
-> Containers::Array<Types::UnrealPropertyBase::ptr>;
|
|
|
|
auto deserialise(Containers::String name, Containers::String type, std::size_t value_length,
|
2024-03-08 21:18:17 +01:00
|
|
|
BinaryIo::Reader& reader) -> Types::UnrealPropertyBase::ptr;
|
2023-11-29 12:33:26 +01:00
|
|
|
|
|
|
|
bool serialise(Types::UnrealPropertyBase::ptr& prop, Containers::StringView item_type,
|
2024-03-08 21:18:17 +01:00
|
|
|
std::size_t& bytes_written, BinaryIo::Writer& writer);
|
|
|
|
bool write(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer);
|
2023-11-29 12:33:26 +01:00
|
|
|
bool writeItem(Types::UnrealPropertyBase::ptr& prop, Containers::StringView item_type,
|
2024-03-08 21:18:17 +01:00
|
|
|
std::size_t& bytes_written, BinaryIo::Writer& writer);
|
2023-11-29 12:33:26 +01:00
|
|
|
bool writeSet(Containers::ArrayView<Types::UnrealPropertyBase::ptr> props, Containers::StringView item_type,
|
2024-03-08 21:18:17 +01:00
|
|
|
std::size_t& bytes_written, BinaryIo::Writer& writer);
|
2023-11-29 12:33:26 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
PropertySerialiser();
|
|
|
|
|
|
|
|
auto getSerialiser(Containers::StringView item_type) -> Serialisers::AbstractUnrealProperty*;
|
|
|
|
auto getCollectionSerialiser(Containers::StringView item_type) -> Serialisers::AbstractUnrealCollectionProperty*;
|
|
|
|
|
|
|
|
Containers::Array<Serialisers::AbstractUnrealProperty::ptr> _serialisers;
|
|
|
|
Containers::Array<Serialisers::AbstractUnrealCollectionProperty::ptr> _collectionSerialisers;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|