libcmo21/LibCmo/CK2/CKDefines.hpp

75 lines
2.9 KiB
C++
Raw Normal View History

2023-08-22 15:30:26 +08:00
#pragma once
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
*/
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()>;
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 {
CKBOOL Done;
// 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() :
Done(CKFALSE),
Self(CK_CLASSID::CKCID_OBJECT), Parent(CK_CLASSID::CKCID_OBJECT),
CreationFct(nullptr), ReleaseFct(nullptr), NameFct(nullptr),
DerivationLevel(0),
Parents(), Children()
{}
LIBCMO_DEFAULT_COPY_MOVE(CKClassDesc);
2023-08-23 16:04:58 +08:00
};
2023-08-22 15:30:26 +08:00
}