// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
#pragma once
#include "Engine/Core/Collections/Array.h"
#include "Engine/Serialization/Stream.h"
///
/// Visject metadata container
///
class VisjectMeta
{
public:
///
/// Metadata entry
///
struct Entry
{
int32 TypeID;
bool IsLoaded;
Array Data;
};
public:
///
/// All meta entries
///
Array> Entries;
public:
///
/// Initializes a new instance of the class.
///
VisjectMeta();
///
/// Finalizes an instance of the class.
///
~VisjectMeta()
{
}
public:
///
/// Load from the stream
///
/// Stream
/// True if load meta data
/// True if cannot load data
bool Load(ReadStream* stream, bool loadData);
///
/// Save to the stream
///
/// Stream
/// True if load meta data
/// True if cannot save data
bool Save(WriteStream* stream, bool saveData) const;
///
/// Release meta data
///
void Release();
///
/// Get entry
///
/// Entry type ID
/// Entry
const Entry* GetEntry(int32 typeID) const;
///
/// Get entry
///
/// Entry type ID
/// Entry
Entry* GetEntry(int32 typeID);
///
/// Add new entry
///
/// Type ID
/// Bytes to set
/// Amount of bytes to assign
void AddEntry(int32 typeID, byte* data, int32 size);
};