2023-08-22 15:30:26 +08:00
|
|
|
#pragma once
|
|
|
|
|
2023-09-05 22:23:05 +08:00
|
|
|
#include "../VTUtils.hpp"
|
2023-08-23 16:04:58 +08:00
|
|
|
#include "CKTypes.hpp"
|
|
|
|
#include "../XContainer/XTypes.hpp"
|
2023-08-22 15:30:26 +08:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <cstring>
|
|
|
|
#include <cinttypes>
|
2023-08-23 16:04:58 +08:00
|
|
|
#include <functional>
|
2023-08-22 15:30:26 +08:00
|
|
|
|
|
|
|
namespace LibCmo::CK2 {
|
2023-08-28 17:04:28 +08:00
|
|
|
/**
|
|
|
|
* @brief The identifier of Virtools file.
|
|
|
|
*/
|
|
|
|
constexpr const char CKNEMOFI[] = "Nemo Fi";
|
2023-08-22 15:30:26 +08:00
|
|
|
/**
|
|
|
|
* @brief Current Version of CK Engine (Day/Month/Year)
|
|
|
|
*/
|
2023-08-28 17:04:28 +08:00
|
|
|
constexpr const CKDWORD CKVERSION = 0x13022002u;
|
2023-08-22 15:30:26 +08:00
|
|
|
/**
|
|
|
|
* @brief Current Version of Dev
|
|
|
|
*/
|
2023-08-28 22:20:46 +08:00
|
|
|
constexpr const CKDWORD DEVBUILD = 0x02010001u;
|
|
|
|
constexpr const CKDWORD DEVVERSION = 0u;
|
2023-08-22 15:30:26 +08:00
|
|
|
constexpr const CKGUID VIRTOOLS_GUID = CKGUID(0x56495254u, 0x4f4f4c53u);
|
2023-08-23 16:04:58 +08:00
|
|
|
|
|
|
|
// ========== Class registration utilities ==========
|
|
|
|
|
|
|
|
//using CKClassRegisterFct = std::function<void()>;
|
2023-08-26 16:37:26 +08:00
|
|
|
using CKClassCreationFct = std::function<ObjImpls::CKObject* (CKContext*, CK_ID, CKSTRING)>;
|
|
|
|
using CKClassReleaseFct = std::function<void(CKContext*, ObjImpls::CKObject*)>;
|
2023-08-23 16:04:58 +08:00
|
|
|
using CKClassNameFct = std::function<CKSTRING()>;
|
|
|
|
//using CKClassDependenciesFct = std::function<CKSTRING(CKINT, CKINT)>;
|
|
|
|
//using CKClassDependenciesCountFct = std::function<CKINT(CKINT)>;
|
|
|
|
|
|
|
|
struct CKClassDesc {
|
2023-09-01 12:19:06 +08:00
|
|
|
bool IsValid; /**< True if this CKClassDesc is a valid one. Because CK_CLASSID may not be consecutive. */
|
2023-08-29 14:00:34 +08:00
|
|
|
bool Done;
|
2023-08-23 16:04:58 +08:00
|
|
|
// Initialized upon class registration
|
|
|
|
CK_CLASSID Self;
|
|
|
|
CK_CLASSID Parent; // Class Identifier of parent class
|
|
|
|
//CKClassRegisterFct RegisterFct; // Pointer to Class Specific Registration function
|
|
|
|
CKClassCreationFct CreationFct; // Pointer to Class instance creation function
|
|
|
|
CKClassReleaseFct ReleaseFct; // Pointer to Class instance release function
|
|
|
|
CKClassNameFct NameFct; // Pointer to Class name function
|
|
|
|
//CKClassDependenciesFct DependsFct; // Pointer to Class dependencies function (Copy,delete,replace...)
|
|
|
|
//CKClassDependenciesCountFct DependsCountFct; // Pointer to Class dependencies Count function (Copy,delete,replace...)
|
|
|
|
|
|
|
|
//// Initialized by class specific registration function
|
|
|
|
//CKDWORD DefaultOptions; // Default options for this class
|
|
|
|
//CKDWORD DefaultCopyDependencies;
|
|
|
|
//CKDWORD DefaultDeleteDependencies;
|
|
|
|
//CKDWORD DefaultReplaceDependencies;
|
|
|
|
//CKDWORD DefaultSaveDependencies;
|
|
|
|
//CKGUID Parameter; // Associated parameter GUID
|
|
|
|
|
|
|
|
// Initialized when building class hierarchy table
|
|
|
|
CKINT DerivationLevel; // O => CKObject , etc..
|
|
|
|
XContainer::XBitArray Parents; // Bit Mask of parents classes
|
|
|
|
XContainer::XBitArray Children; // Bit Mask of children classes
|
|
|
|
//XContainer::XBitArray ToBeNotify; // Mask for Classes that should warn the objects of this class when they are deleted
|
|
|
|
//XContainer::XBitArray CommonToBeNotify; // idem but merged with sub classes masks
|
|
|
|
//XContainer::XSArray<CK_CLASSID> ToNotify; // List of ClassID to notify when an object of this class is deleted (inverse of ToBeNotify)
|
|
|
|
|
|
|
|
CKClassDesc() :
|
2023-09-01 12:19:06 +08:00
|
|
|
IsValid(false),
|
2023-08-29 14:00:34 +08:00
|
|
|
Done(false),
|
2023-08-23 16:04:58 +08:00
|
|
|
Self(CK_CLASSID::CKCID_OBJECT), Parent(CK_CLASSID::CKCID_OBJECT),
|
|
|
|
CreationFct(nullptr), ReleaseFct(nullptr), NameFct(nullptr),
|
|
|
|
DerivationLevel(0),
|
|
|
|
Parents(), Children()
|
|
|
|
{}
|
2023-08-26 16:37:26 +08:00
|
|
|
LIBCMO_DEFAULT_COPY_MOVE(CKClassDesc);
|
2023-08-23 16:04:58 +08:00
|
|
|
};
|
|
|
|
|
2023-08-22 15:30:26 +08:00
|
|
|
}
|