refactor: refactor project
- rename LIBCMO_DISABLE_COPY_MOVE -> YYCC_DEL_CLS_COPY_MOVE and LIBCMO_DEFAULT_COPY_MOVE -> YYCC_DEF_CLS_COPY_MOVE. - fix Vector declaration generator. throw exception when operator[] face invalid index, instead of do fallback. - rename VTAll.hpp -> VTInternal.hpp and VYUserAll -> VTAll.hpp for easy to understand. - fix project name error in Doxygen template. - replace all LIBCMO_OS_WIN32 to YYCC_OS == YYCC_OS_WINDOWS. - fix some compile error (involving utf8 encoding) but not the final result. - use correct way to include std-image library (use <> instead of "") - finish documentation for VTUtils.hpp and VTEncoding.hpp.
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../VTAll.hpp"
|
||||
#include "../VTInternal.hpp"
|
||||
|
||||
namespace LibCmo::CK2 {
|
||||
|
||||
@ -26,7 +26,7 @@ namespace LibCmo::CK2 {
|
||||
CKBitmapSlot() :
|
||||
m_ImageData(), m_FileName() {}
|
||||
~CKBitmapSlot() {}
|
||||
LIBCMO_DEFAULT_COPY_MOVE(CKBitmapSlot);
|
||||
YYCC_DEF_CLS_COPY_MOVE(CKBitmapSlot);
|
||||
|
||||
VxMath::VxImageDescEx m_ImageData;
|
||||
XContainer::XString m_FileName;
|
||||
@ -36,7 +36,7 @@ namespace LibCmo::CK2 {
|
||||
public:
|
||||
CKBitmapData(CKContext* ctx);
|
||||
~CKBitmapData();
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKBitmapData);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKBitmapData);
|
||||
|
||||
#pragma region RW Funcs
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../VTAll.hpp"
|
||||
#include "../VTInternal.hpp"
|
||||
#include <map>
|
||||
#include <deque>
|
||||
#include <functional>
|
||||
@ -21,7 +21,7 @@ namespace LibCmo::CK2 {
|
||||
public:
|
||||
CKContext();
|
||||
~CKContext();
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKContext);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKContext);
|
||||
|
||||
// ========== Engine runtime ==========
|
||||
public:
|
||||
|
@ -136,7 +136,7 @@ namespace LibCmo::CK2 {
|
||||
m_ReaderGuid(), m_Ext() {}
|
||||
CKBitmapProperties(const CKGUID& guid, CKSTRING ext) :
|
||||
m_ReaderGuid(guid), m_Ext(ext) {}
|
||||
LIBCMO_DEFAULT_COPY_MOVE(CKBitmapProperties);
|
||||
YYCC_DEF_CLS_COPY_MOVE(CKBitmapProperties);
|
||||
|
||||
CKGUID m_ReaderGuid; /**< CKGUID that uniquely identifies the reader that created this properties structure */
|
||||
CKFileExtension m_Ext; /**< File Extension of the image being described by this structure */
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../VTAll.hpp"
|
||||
#include "../VTInternal.hpp"
|
||||
|
||||
namespace LibCmo::XContainer {
|
||||
using XIntArray = XArray<CKINT>;
|
||||
@ -40,7 +40,7 @@ namespace LibCmo::CK2 {
|
||||
~CKBufferParser() {
|
||||
if (this->m_NeedManualFree) delete[](this->m_MemBegin);
|
||||
}
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKBufferParser);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKBufferParser);
|
||||
|
||||
const void* GetPtr(CKINT extraoff = 0) { return (this->m_MemBegin + m_MemPos + extraoff); }
|
||||
void* GetMutablePtr(CKINT extraoff = 0) { return (this->m_MemBegin + m_MemPos + extraoff); }
|
||||
@ -97,7 +97,7 @@ namespace LibCmo::CK2 {
|
||||
ObjectCount(0u), ManagerCount(0u), MaxIDSaved(0u), Crc(0u),
|
||||
Hdr1PackSize(0u), Hdr1UnPackSize(0u), DataPackSize(0u), DataUnPackSize(0u) {}
|
||||
~CKFileInfo() {}
|
||||
LIBCMO_DEFAULT_COPY_MOVE(CKFileInfo);
|
||||
YYCC_DEF_CLS_COPY_MOVE(CKFileInfo);
|
||||
|
||||
CKDWORD ProductVersion; /**< Virtools Version (Dev/Creation). (CK_VIRTOOLS_VERSION) */
|
||||
CKDWORD ProductBuild; /**< Virtools Build Number. */
|
||||
@ -156,7 +156,7 @@ namespace LibCmo::CK2 {
|
||||
CKFilePluginDependencies() :
|
||||
m_PluginCategory(CK_PLUGIN_TYPE::CKPLUGIN_MANAGER_DLL), m_Guids() {}
|
||||
~CKFilePluginDependencies() {}
|
||||
LIBCMO_DEFAULT_COPY_MOVE(CKFilePluginDependencies);
|
||||
YYCC_DEF_CLS_COPY_MOVE(CKFilePluginDependencies);
|
||||
|
||||
CK_PLUGIN_TYPE m_PluginCategory;
|
||||
XContainer::XArray<CKGUID> m_Guids;
|
||||
@ -188,7 +188,7 @@ namespace LibCmo::CK2 {
|
||||
public:
|
||||
CKFileReader(CKContext* ctx);
|
||||
~CKFileReader();
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKFileReader);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKFileReader);
|
||||
|
||||
// ========== Loading ==========
|
||||
CKERROR ShallowLoad(CKSTRING u8_filename);
|
||||
@ -229,7 +229,7 @@ namespace LibCmo::CK2 {
|
||||
CKFileWriter(CKContext* ctx);
|
||||
CKFileWriter(CKContext* ctx, CKFileReader* reader, bool is_shallow);
|
||||
~CKFileWriter();
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKFileWriter);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKFileWriter);
|
||||
|
||||
// ========== Saving Preparing ==========
|
||||
bool AddSavedObject(ObjImpls::CKObject* obj, CKDWORD flags = CK_STATESAVE_ALL);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "../VTUtils.hpp"
|
||||
#if defined(LIBCMO_OS_WIN32)
|
||||
#if YYCC_OS == YYCC_OS_WINDOWS
|
||||
#define ZLIB_WINAPI
|
||||
#endif
|
||||
#include <zconf.h>
|
||||
@ -76,7 +76,10 @@ namespace LibCmo::CK2 {
|
||||
} else {
|
||||
if (str2 == nullptr) return false;
|
||||
else {
|
||||
return std::strcmp(str1, str2) == 0;
|
||||
return std::strcmp(
|
||||
YYCC::EncodingHelper::ToOrdinary(str1),
|
||||
YYCC::EncodingHelper::ToOrdinary(str2)
|
||||
) == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -90,21 +93,21 @@ namespace LibCmo::CK2 {
|
||||
else {
|
||||
// do real cmp
|
||||
size_t i = 0;
|
||||
while (str1[i] != '\0' && str2[i] != '\0') {
|
||||
while (str1[i] != u8'\0' && str2[i] != u8'\0') {
|
||||
if (std::tolower(str1[i]) != std::tolower(str2[i])) return false;
|
||||
++str1;
|
||||
++str2;
|
||||
}
|
||||
|
||||
// !XOR the result, if both of them is zero, return true(1)
|
||||
return !((str1[i] != '\0') ^ (str2[i] != '\0'));
|
||||
return !((str1[i] != u8'\0') ^ (str2[i] != u8'\0'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CKStrEmpty(CKSTRING strl) {
|
||||
if (strl == nullptr) return true;
|
||||
return strl[0] == '\0';
|
||||
return strl[0] == u8'\0';
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
@ -112,7 +115,7 @@ namespace LibCmo::CK2 {
|
||||
#pragma region CKClass Registration
|
||||
|
||||
static XContainer::XArray<CKClassDesc> g_CKClassInfo;
|
||||
|
||||
|
||||
static bool GetClassIdIndex(CK_CLASSID cid, size_t& intcid) {
|
||||
intcid = static_cast<size_t>(cid);
|
||||
if (intcid >= g_CKClassInfo.size()) return false;
|
||||
@ -123,7 +126,7 @@ namespace LibCmo::CK2 {
|
||||
void CKClassNeedNotificationFrom(CK_CLASSID listener, CK_CLASSID listenTo) {
|
||||
size_t idxListener, idxListenTo;
|
||||
if (!GetClassIdIndex(listener, idxListener) || !GetClassIdIndex(listenTo, idxListenTo)) return;
|
||||
|
||||
|
||||
XContainer::NSXBitArray::Set(g_CKClassInfo[idxListener].ToBeNotify, static_cast<CKDWORD>(idxListenTo));
|
||||
}
|
||||
|
||||
@ -173,7 +176,7 @@ namespace LibCmo::CK2 {
|
||||
|
||||
CKSTRING CKClassIDToString(CK_CLASSID cid) {
|
||||
const CKClassDesc* desc = CKGetClassDesc(cid);
|
||||
if (desc == nullptr) return "Undefined Type";
|
||||
if (desc == nullptr) return u8"Undefined Type";
|
||||
else return desc->NameFct();
|
||||
}
|
||||
|
||||
@ -237,14 +240,14 @@ namespace LibCmo::CK2 {
|
||||
B and BB have the same goods so A can buy his stuff from both of B and BB.
|
||||
This is the first step executed by ComputeParentsNotifyTable().
|
||||
In this step, the function expand existing business relations to all possible business relations (expand to businessman's children)
|
||||
|
||||
|
||||
Image there is a candy store, C. Because AA still is a kids.
|
||||
So AA want to buy something from C. Now C is in his ToBeNotify.
|
||||
Additionally, A, the parent of AA, force AA to buy something from B, just for A himself.
|
||||
For AA, he does not need want to buy something from B, but his parent A order he to do.
|
||||
This is the second step executed by ComputeParentsNotifyTable().
|
||||
For AA, his parent's relations also need to be merged after he processed his relations with C like I introduced previously.
|
||||
|
||||
|
||||
Now, AA have a full business list writing all trades he can do.
|
||||
This is represented as CommonToBeNotify.
|
||||
In this time, AA's ToBeNotify only have C, but his CommonToBeNotify have B, BB and C.
|
||||
@ -254,7 +257,7 @@ namespace LibCmo::CK2 {
|
||||
Because a full trades list are created from A side.
|
||||
The better solution is just ask the guest: do you want to buy something from me?
|
||||
This operation will fill ToNotify and is implemented at ComputeHierarchyTable().
|
||||
|
||||
|
||||
At the end of this story,
|
||||
All bussiness man can use ToNofity to see whom they want to sell something to.
|
||||
And all buyer can use CommonToBeNofity to check who they can buy something from.
|
||||
@ -267,7 +270,7 @@ namespace LibCmo::CK2 {
|
||||
|
||||
// find direct parent
|
||||
CKClassDesc& parent = g_CKClassInfo[static_cast<size_t>(desc.Parent)];
|
||||
if (!parent.IsValid) LIBCMO_PANIC("No such CK_CLASSID.");
|
||||
if (!parent.IsValid) throw LogicException("No such CK_CLASSID.");
|
||||
|
||||
// if it is not self inheritance, call recursively
|
||||
if (desc.Self != desc.Parent) {
|
||||
@ -281,26 +284,26 @@ namespace LibCmo::CK2 {
|
||||
|
||||
// set derivation level
|
||||
desc.DerivationLevel = parent.DerivationLevel + 1;
|
||||
|
||||
|
||||
// set done
|
||||
desc.Done = true;
|
||||
}
|
||||
static void ComputeParentsNotifyTable(CKClassDesc& desc) {
|
||||
// if it has done, do not process it again.
|
||||
if (desc.Done) return;
|
||||
|
||||
|
||||
// find direct parent
|
||||
CKClassDesc& parent = g_CKClassInfo[static_cast<size_t>(desc.Parent)];
|
||||
if (!parent.IsValid) LIBCMO_PANIC("No such CK_CLASSID.");
|
||||
if (!parent.IsValid) throw LogicException("No such CK_CLASSID.");
|
||||
|
||||
// if it is not self inheritance, call recursively
|
||||
if (desc.Self != desc.Parent) {
|
||||
ComputeParentsNotifyTable(parent);
|
||||
}
|
||||
|
||||
|
||||
// add all children of ToBeNofity list
|
||||
for (CKDWORD idx = 0; idx < desc.ToBeNotify.size(); ++idx) {
|
||||
if (!XContainer::NSXBitArray::IsSet(desc.ToBeNotify, idx))
|
||||
if (!XContainer::NSXBitArray::IsSet(desc.ToBeNotify, idx))
|
||||
continue;
|
||||
|
||||
CKClassDesc& target = g_CKClassInfo[idx];
|
||||
@ -352,7 +355,7 @@ namespace LibCmo::CK2 {
|
||||
if (!item.IsValid || item.RegisterFct == nullptr) continue;
|
||||
item.RegisterFct();
|
||||
}
|
||||
|
||||
|
||||
// ===== Build Notify Hierarchy =====
|
||||
// set array first
|
||||
for (auto& item : g_CKClassInfo) {
|
||||
@ -398,13 +401,13 @@ CKClassRegister(cid, parentCid, \
|
||||
nullptr, \
|
||||
[](CKContext* ctx, CK_ID id, CKSTRING name) -> ObjImpls::CKObject* { return new clsname(ctx, id, name); }, \
|
||||
[](CKContext* ctx, ObjImpls::CKObject* obj) -> void { delete obj; }, \
|
||||
[]() -> CKSTRING { return strName; });
|
||||
[]() -> CKSTRING { return u8 ## strName; });
|
||||
#define EasyClassRegWithNotify(clsname, cid, parentCid, strName, notifyCids) \
|
||||
CKClassRegister(cid, parentCid, \
|
||||
[]() -> void { NeedNotificationWrapper(cid, notifyCids); }, \
|
||||
[](CKContext* ctx, CK_ID id, CKSTRING name) -> ObjImpls::CKObject* { return new clsname(ctx, id, name); }, \
|
||||
[](CKContext* ctx, ObjImpls::CKObject* obj) -> void { delete obj; }, \
|
||||
[]() -> CKSTRING { return strName; });
|
||||
[]() -> CKSTRING { return u8 ## strName; });
|
||||
|
||||
EasyClassReg(ObjImpls::CKObject, CK_CLASSID::CKCID_OBJECT, CK_CLASSID::CKCID_OBJECT, "Basic Object");
|
||||
EasyClassReg(ObjImpls::CKSceneObject, CK_CLASSID::CKCID_SCENEOBJECT, CK_CLASSID::CKCID_OBJECT, "Scene Object");
|
||||
|
@ -118,7 +118,7 @@ namespace LibCmo::CK2 {
|
||||
DerivationLevel(0),
|
||||
Parents(), Children(), ToBeNotify(), CommonToBeNotify()
|
||||
{}
|
||||
LIBCMO_DEFAULT_COPY_MOVE(CKClassDesc);
|
||||
YYCC_DEF_CLS_COPY_MOVE(CKClassDesc);
|
||||
};
|
||||
|
||||
// ========== CKClass Registration ==========
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../VTAll.hpp"
|
||||
#include "../VTInternal.hpp"
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
@ -54,7 +54,7 @@ namespace LibCmo::CK2 {
|
||||
LockedReadBufferDeleter() : m_Host(nullptr), m_ConsumedSize(0) {}
|
||||
LockedReadBufferDeleter(CKStateChunk* host, CKDWORD init_size) :
|
||||
m_Host(host), m_ConsumedSize(init_size) {}
|
||||
LIBCMO_DEFAULT_COPY_MOVE(LockedReadBufferDeleter);
|
||||
YYCC_DEF_CLS_COPY_MOVE(LockedReadBufferDeleter);
|
||||
|
||||
void operator()(LIBCMO_UNUSED const void* buf);
|
||||
void SetConsumedSize(CKDWORD newsize);
|
||||
@ -68,7 +68,7 @@ namespace LibCmo::CK2 {
|
||||
LockedWriteBufferDeleter() : m_Host(nullptr), m_ConsumedSize(0) {}
|
||||
LockedWriteBufferDeleter(CKStateChunk* host, CKDWORD init_size) :
|
||||
m_Host(host), m_ConsumedSize(init_size) {}
|
||||
LIBCMO_DEFAULT_COPY_MOVE(LockedWriteBufferDeleter);
|
||||
YYCC_DEF_CLS_COPY_MOVE(LockedWriteBufferDeleter);
|
||||
|
||||
void operator()(LIBCMO_UNUSED const void* buf);
|
||||
void SetConsumedSize(CKDWORD newsize);
|
||||
@ -82,7 +82,7 @@ namespace LibCmo::CK2 {
|
||||
BufferDeleter() : m_Host(nullptr), m_BufSize(0) {}
|
||||
BufferDeleter(CKStateChunk* host, CKDWORD bufsize) :
|
||||
m_Host(host), m_BufSize(bufsize) {}
|
||||
LIBCMO_DEFAULT_COPY_MOVE(BufferDeleter);
|
||||
YYCC_DEF_CLS_COPY_MOVE(BufferDeleter);
|
||||
|
||||
void operator()(const void* buf);
|
||||
CKDWORD GetBufferSize() const;
|
||||
|
@ -16,22 +16,22 @@ namespace LibCmo {
|
||||
// So we declare them in LibCmo, not LibCmo::CK2 to make sure every module can use it.
|
||||
|
||||
/**
|
||||
* @brief General Const String Type. Encoding Unrelated.
|
||||
* @brief General constant UTF8 string type.
|
||||
*/
|
||||
using CKSTRING = const char*;
|
||||
using CKSTRING = const char8_t*;
|
||||
/**
|
||||
* @brief Changeble CKSTRING.
|
||||
* @see CKSTRING
|
||||
*/
|
||||
using CKMUTSTRING = char*;
|
||||
using CKMUTSTRING = char8_t*;
|
||||
/**
|
||||
* @brief The Representation of Single Character (1 byte). Encoding Unrelated.
|
||||
* @remark
|
||||
* + Only used with string process.
|
||||
* + For memory representation and moving, use CKBYTE instead.
|
||||
* @brief The representation of single UTF8 code unit (1 byte).
|
||||
* @remarks
|
||||
* \li Only used with string process.
|
||||
* \li For memory representation and moving, use CKBYTE instead.
|
||||
* @see CKBYTE
|
||||
*/
|
||||
using CKCHAR = char;
|
||||
using CKCHAR = char8_t;
|
||||
|
||||
/**
|
||||
* @brief Always Represent a Byte (1 byte, unsigned). Platform Independent.
|
||||
@ -58,8 +58,8 @@ namespace LibCmo {
|
||||
/**
|
||||
* @brief The Int type used in LibCmo.
|
||||
* @remark
|
||||
* + All 'int' type in original Virtools SDK should be replaced with CKINT in this project if needed.
|
||||
* + This type also can be seen as the equvalent of signed CKDWORD.
|
||||
* \i All \c int type in original Virtools SDK should be replaced with CKINT in this project if needed.
|
||||
* \li This type also can be seen as the equvalent of signed CKDWORD.
|
||||
* @see CKDWORD
|
||||
*/
|
||||
using CKINT = int32_t;
|
||||
@ -76,15 +76,15 @@ namespace LibCmo {
|
||||
/**
|
||||
* @brief Represent a x86 Platform Pointer.
|
||||
* @remark
|
||||
* + This type only can be used when replacing pointer in old Virtools struct / class.
|
||||
* + Due to Virtools shitty design, in some cases we need read data with x86 memory layout from file.
|
||||
* \li This type only can be used when replacing pointer in old Virtools struct / class.
|
||||
* \li Due to Virtools shitty design, in some cases we need read data with x86 memory layout from file.
|
||||
* So we use this type to replace native pointer in struct existed in Virtools SDK to make sure this
|
||||
* program can run perfectly on x64 and more architectures.
|
||||
* + A example can be found in CKTexture::Load().
|
||||
* \li A example usage can be found in CK2::ObjImpls::CKTexture::Load().
|
||||
*/
|
||||
using CKPTR = uint32_t;
|
||||
|
||||
// Format constants for the std::fprintf family of functions
|
||||
// Format macro for \c std::printf family of functions
|
||||
|
||||
#define PRI_CKSTRING "s"
|
||||
#define PRI_CKCHAR "c"
|
||||
@ -113,11 +113,12 @@ namespace LibCmo {
|
||||
|
||||
#define PRIxCKPTR PRIx32
|
||||
#define PRIXCKPTR PRIX32
|
||||
|
||||
/*
|
||||
The convenient sizeof which return CKDWORD, not size_t.
|
||||
|
||||
/**
|
||||
* @brief The convenient sizeof macro which return \c CKDWORD instead of \c size_t.
|
||||
* This is usually used in LibCmo because LibCmo use \c CKDWORD, not \c size_t everywhere.
|
||||
*/
|
||||
#define CKSizeof(_Ty) (static_cast<LibCmo::CKDWORD>(sizeof(_Ty)))
|
||||
#define CKSizeof(_Ty) (static_cast<::LibCmo::CKDWORD>(sizeof(_Ty)))
|
||||
|
||||
}
|
||||
|
||||
@ -126,17 +127,17 @@ namespace LibCmo {
|
||||
namespace LibCmo::CK2 {
|
||||
|
||||
/**
|
||||
@brief Unique Identifier for all Objects instanciated in a given CKContext
|
||||
@remarks
|
||||
+ Each instance of CKObject and derived classes are automatically given a global unique
|
||||
ID at creation time. This ID can be accessed through the CKObject::GetID method.
|
||||
It is safer, though a bit slower, to reference object through their global ID than through
|
||||
a direct pointer reference. In any case the referenced object may be deleted even though
|
||||
the client object has a ID for it. The client object should verify that the referenced object
|
||||
still exists when used with the CKGetObject function.
|
||||
+ The global ID for an instance remains unique and unchanged through a application session, but there
|
||||
is no garanty that this ID will be the same when a level is saved and loaded back again.
|
||||
@see CKObject::GetID, CKContext::GetObject
|
||||
* @brief Unique Identifier for all Objects instanciated in a given CKContext
|
||||
* @remarks
|
||||
* \li Each instance of CKObject and derived classes are automatically given a global unique
|
||||
* ID at creation time. This ID can be accessed through the CKObject::GetID method.
|
||||
* It is safer, though a bit slower, to reference object through their global ID than through
|
||||
* a direct pointer reference. In any case the referenced object may be deleted even though
|
||||
* the client object has a ID for it. The client object should verify that the referenced object
|
||||
* still exists when used with the CKGetObject function.
|
||||
* \li The global ID for an instance remains unique and unchanged through a application session, but there
|
||||
* is no garanty that this ID will be the same when a level is saved and loaded back again.
|
||||
* @see CKObject::GetID, CKContext::GetObject
|
||||
*/
|
||||
using CK_ID = CKDWORD;
|
||||
|
||||
@ -195,14 +196,14 @@ namespace LibCmo::CK2 {
|
||||
};
|
||||
|
||||
/**
|
||||
@brief Per Class Unique Identifier.
|
||||
@remark
|
||||
+ Each class derived from the CKObject class has a unique class ID.
|
||||
+ This ID can be accessed through each instance of these classes, with the
|
||||
CKObject::GetClassID method.
|
||||
+ This class ID is used internally for various matching operations, like matching behaviors on
|
||||
objects, etc..
|
||||
@see CKObject::GetClassID, CKIsChildClassOf, Class Identifiers
|
||||
* @brief Per Class Unique Identifier.
|
||||
* @remark
|
||||
* \li Each class derived from the CKObject class has a unique class ID.
|
||||
* \li This ID can be accessed through each instance of these classes, with the
|
||||
* CKObject::GetClassID method.
|
||||
* \li This class ID is used internally for various matching operations, like matching behaviors on
|
||||
* objects, etc..
|
||||
* @see CKObject::GetClassID, CKIsChildClassOf, Class Identifiers
|
||||
*/
|
||||
enum class CK_CLASSID : CKINT {
|
||||
CKCID_OBJECT = 1,
|
||||
@ -289,8 +290,10 @@ namespace LibCmo::CK2 {
|
||||
#define PRIiCLASSID PRIiCKINT
|
||||
|
||||
// ========== Class List ==========
|
||||
// We declare these classes in there to make sure that
|
||||
// following code can refer their pointer type safely.
|
||||
|
||||
// Objects and derivated classes
|
||||
|
||||
namespace ObjImpls {
|
||||
class CKObject;
|
||||
class CKInterfaceObjectManager;
|
||||
@ -345,7 +348,7 @@ namespace LibCmo::CK2 {
|
||||
class CKGrid;
|
||||
}
|
||||
|
||||
//---- Misc
|
||||
// Misc
|
||||
class CKBehaviorPrototype;
|
||||
class CKMessage;
|
||||
class CK2dCurvePoint;
|
||||
@ -362,7 +365,7 @@ namespace LibCmo::CK2 {
|
||||
class CKFileExtension;
|
||||
class CKVertexBuffer;
|
||||
|
||||
//--- Managers
|
||||
// Managers
|
||||
namespace MgrImpls {
|
||||
class CKBaseManager;
|
||||
class CKObjectManager;
|
||||
@ -379,13 +382,14 @@ namespace LibCmo::CK2 {
|
||||
class CKPluginManager;
|
||||
}
|
||||
|
||||
// Data Handlers
|
||||
namespace DataHandlers {
|
||||
class CKBitmapHandler;
|
||||
class CKMovieHandler;
|
||||
class CKSoundHandler;
|
||||
}
|
||||
|
||||
//--- Important classes
|
||||
// Important classes
|
||||
class CKContext;
|
||||
class CKStateChunk;
|
||||
class CKFileReader;
|
||||
@ -393,22 +397,20 @@ namespace LibCmo::CK2 {
|
||||
class CKFileVisitor;
|
||||
|
||||
/**
|
||||
@brief Global Unique Identifier Struture.
|
||||
@remark
|
||||
+ Guids are used to uniquely identify plugins,operation types, parameter types and behavior prototypes.
|
||||
+ Its defined as
|
||||
```
|
||||
typedef struct CKGUID {
|
||||
union {
|
||||
struct { CKDWORD d1,d2; };
|
||||
CKDWORD d[2];
|
||||
};
|
||||
};
|
||||
```
|
||||
+ Comparison operators are defined so CKGUIDS can be compared with
|
||||
==, != , <, > operators.
|
||||
|
||||
@see Pre-Registred Parameter Types, ParameterOperation Types
|
||||
* @brief Global Unique Identifier Struture.
|
||||
* @remark
|
||||
* \li Guids are used to uniquely identify plugins,operation types, parameter types and behavior prototypes.
|
||||
* \li Comparison operators are defined so CKGUID can be compared with ==, != , <, > operators.
|
||||
* \li Its defined as following code
|
||||
* \code
|
||||
* typedef struct CKGUID {
|
||||
* union {
|
||||
* struct { CKDWORD d1,d2; };
|
||||
* CKDWORD d[2];
|
||||
* };
|
||||
* };
|
||||
* \endcode
|
||||
* @see Pre-Registred Parameter Types, ParameterOperation Types
|
||||
*/
|
||||
struct CKGUID {
|
||||
CKDWORD d1, d2;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "CKBitmapHandler.hpp"
|
||||
#include "stb_image.h"
|
||||
#include "stb_image_write.h"
|
||||
#include <stb_image.h>
|
||||
#include <stb_image_write.h>
|
||||
|
||||
namespace LibCmo::CK2::DataHandlers {
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../VTAll.hpp"
|
||||
#include "../../VTInternal.hpp"
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
|
||||
@ -30,7 +30,7 @@ namespace LibCmo::CK2::DataHandlers {
|
||||
public:
|
||||
CKBitmapHandler() {}
|
||||
virtual ~CKBitmapHandler() {}
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKBitmapHandler);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKBitmapHandler);
|
||||
|
||||
/**
|
||||
* @brief General CKBitmapHandler getter.
|
||||
@ -102,7 +102,7 @@ namespace LibCmo::CK2::DataHandlers {
|
||||
public:
|
||||
CKBitmapBMPHandler();
|
||||
virtual ~CKBitmapBMPHandler();
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKBitmapBMPHandler);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKBitmapBMPHandler);
|
||||
|
||||
static const CKBitmapProperties& GetBitmapDefaultProperties();
|
||||
|
||||
@ -118,7 +118,7 @@ namespace LibCmo::CK2::DataHandlers {
|
||||
public:
|
||||
CKBitmapTGAHandler();
|
||||
virtual ~CKBitmapTGAHandler();
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKBitmapTGAHandler);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKBitmapTGAHandler);
|
||||
|
||||
static const CKBitmapProperties& GetBitmapDefaultProperties();
|
||||
|
||||
@ -134,7 +134,7 @@ namespace LibCmo::CK2::DataHandlers {
|
||||
public:
|
||||
CKBitmapJPGHandler();
|
||||
virtual ~CKBitmapJPGHandler();
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKBitmapJPGHandler);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKBitmapJPGHandler);
|
||||
|
||||
static const CKBitmapProperties& GetBitmapDefaultProperties();
|
||||
|
||||
@ -150,7 +150,7 @@ namespace LibCmo::CK2::DataHandlers {
|
||||
public:
|
||||
CKBitmapPNGHandler();
|
||||
virtual ~CKBitmapPNGHandler();
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKBitmapPNGHandler);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKBitmapPNGHandler);
|
||||
|
||||
static const CKBitmapProperties& GetBitmapDefaultProperties();
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../VTAll.hpp"
|
||||
#include "../../VTInternal.hpp"
|
||||
|
||||
/**
|
||||
CKBaseManager virtual functions implementations help
|
||||
@ -40,7 +40,7 @@ namespace LibCmo::CK2::MgrImpls {
|
||||
XContainer::NSXString::FromCKSTRING(m_ManagerName, name);
|
||||
}
|
||||
virtual ~CKBaseManager() {}
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKBaseManager);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKBaseManager);
|
||||
|
||||
/**
|
||||
@brief Acces to Manager GUID
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../VTAll.hpp"
|
||||
#include "../../VTInternal.hpp"
|
||||
#include "CKBaseManager.hpp"
|
||||
#include <deque>
|
||||
|
||||
@ -10,7 +10,7 @@ namespace LibCmo::CK2::MgrImpls {
|
||||
public:
|
||||
CKObjectManager(CKContext* ctx);
|
||||
virtual ~CKObjectManager();
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKObjectManager);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKObjectManager);
|
||||
|
||||
// ========== Objects Management ==========
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace LibCmo::CK2::MgrImpls {
|
||||
|
||||
#if defined(LIBCMO_OS_WIN32)
|
||||
#if YYCC_OS == YYCC_OS_WINDOWS
|
||||
static wchar_t g_UniqueFolder[] = L"LibCmo";
|
||||
#else
|
||||
static char g_UniqueFolder[] = "LibCmo";
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../VTAll.hpp"
|
||||
#include "../../VTInternal.hpp"
|
||||
#include "CKBaseManager.hpp"
|
||||
#include <filesystem>
|
||||
|
||||
@ -10,7 +10,7 @@ namespace LibCmo::CK2::MgrImpls {
|
||||
public:
|
||||
CKPathManager(CKContext* ctx);
|
||||
virtual ~CKPathManager();
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKPathManager);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKPathManager);
|
||||
|
||||
/**
|
||||
* @brief Set the temp folder of current context.
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../VTAll.hpp"
|
||||
#include "../../VTInternal.hpp"
|
||||
#include "CKRenderObject.hpp"
|
||||
|
||||
namespace LibCmo::CK2::ObjImpls {
|
||||
@ -9,7 +9,7 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
public:
|
||||
CK3dEntity(CKContext* ctx, CK_ID ckid, CKSTRING name);
|
||||
virtual ~CK3dEntity();
|
||||
LIBCMO_DISABLE_COPY_MOVE(CK3dEntity);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CK3dEntity);
|
||||
|
||||
virtual CK_CLASSID GetClassID(void) override {
|
||||
return CK_CLASSID::CKCID_3DENTITY;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../VTAll.hpp"
|
||||
#include "../../VTInternal.hpp"
|
||||
#include "CK3dEntity.hpp"
|
||||
|
||||
namespace LibCmo::CK2::ObjImpls {
|
||||
@ -11,7 +11,7 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
CK3dEntity(ctx, ckid, name)
|
||||
{}
|
||||
virtual ~CK3dObject() {}
|
||||
LIBCMO_DISABLE_COPY_MOVE(CK3dObject);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CK3dObject);
|
||||
|
||||
virtual CK_CLASSID GetClassID(void) override {
|
||||
return CK_CLASSID::CKCID_3DOBJECT;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../VTAll.hpp"
|
||||
#include "../../VTInternal.hpp"
|
||||
#include "CKSceneObject.hpp"
|
||||
|
||||
namespace LibCmo::CK2::ObjImpls {
|
||||
@ -9,7 +9,7 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
public:
|
||||
CKBeObject(CKContext* ctx, CK_ID ckid, CKSTRING name);
|
||||
virtual ~CKBeObject();
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKBeObject);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKBeObject);
|
||||
|
||||
virtual CK_CLASSID GetClassID(void) override {
|
||||
return CK_CLASSID::CKCID_BEOBJECT;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../VTAll.hpp"
|
||||
#include "../../VTInternal.hpp"
|
||||
#include "CKBeObject.hpp"
|
||||
|
||||
namespace LibCmo::CK2::ObjImpls {
|
||||
@ -9,7 +9,7 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
public:
|
||||
CKGroup(CKContext* ctx, CK_ID ckid, CKSTRING name);
|
||||
virtual ~CKGroup();
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKGroup);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKGroup);
|
||||
|
||||
virtual CK_CLASSID GetClassID(void) override {
|
||||
return CK_CLASSID::CKCID_GROUP;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../VTAll.hpp"
|
||||
#include "../../VTInternal.hpp"
|
||||
#include "CKBeObject.hpp"
|
||||
#include <array>
|
||||
|
||||
@ -10,7 +10,7 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
public:
|
||||
CKMaterial(CKContext* ctx, CK_ID ckid, CKSTRING name);
|
||||
virtual ~CKMaterial();
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKMaterial);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKMaterial);
|
||||
|
||||
virtual CK_CLASSID GetClassID(void) override {
|
||||
return CK_CLASSID::CKCID_MATERIAL;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../VTAll.hpp"
|
||||
#include "../../VTInternal.hpp"
|
||||
#include "CKBeObject.hpp"
|
||||
|
||||
namespace LibCmo::CK2::ObjImpls {
|
||||
@ -19,7 +19,7 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
public:
|
||||
CKMesh(CKContext* ctx, CK_ID ckid, CKSTRING name);
|
||||
virtual ~CKMesh();
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKMesh);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKMesh);
|
||||
|
||||
virtual CK_CLASSID GetClassID(void) override {
|
||||
return CK_CLASSID::CKCID_MESH;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../VTAll.hpp"
|
||||
#include "../../VTInternal.hpp"
|
||||
|
||||
/**
|
||||
CKObject virtual functions implementations help
|
||||
@ -40,7 +40,7 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
public:
|
||||
CKObject(CKContext* ctx, CK_ID ckid, CKSTRING name);
|
||||
virtual ~CKObject();
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKObject);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKObject);
|
||||
|
||||
CK_ID GetID(void) const;
|
||||
CKSTRING GetName(void) const;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../VTAll.hpp"
|
||||
#include "../../VTInternal.hpp"
|
||||
#include "CKBeObject.hpp"
|
||||
|
||||
namespace LibCmo::CK2::ObjImpls {
|
||||
@ -11,7 +11,7 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
CKBeObject(ctx, ckid, name)
|
||||
{}
|
||||
virtual ~CKRenderObject() {}
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKRenderObject);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKRenderObject);
|
||||
|
||||
virtual CK_CLASSID GetClassID(void) override {
|
||||
return CK_CLASSID::CKCID_RENDEROBJECT;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../VTAll.hpp"
|
||||
#include "../../VTInternal.hpp"
|
||||
#include "CKObject.hpp"
|
||||
|
||||
namespace LibCmo::CK2::ObjImpls {
|
||||
@ -11,7 +11,7 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
CKObject(ctx, ckid, name),
|
||||
m_Scenes() {}
|
||||
virtual ~CKSceneObject() {}
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKSceneObject);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKSceneObject);
|
||||
|
||||
virtual CK_CLASSID GetClassID(void) override {
|
||||
return CK_CLASSID::CKCID_SCENEOBJECT;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../VTAll.hpp"
|
||||
#include "../../VTInternal.hpp"
|
||||
#include "../CKBitmapData.hpp"
|
||||
#include "CKBeObject.hpp"
|
||||
|
||||
@ -10,7 +10,7 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
public:
|
||||
CKTexture(CKContext* ctx, CK_ID ckid, CKSTRING name);
|
||||
virtual ~CKTexture();
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKTexture);
|
||||
YYCC_DEL_CLS_COPY_MOVE(CKTexture);
|
||||
|
||||
virtual CK_CLASSID GetClassID(void) override {
|
||||
return CK_CLASSID::CKCID_TEXTURE;
|
||||
|
Reference in New Issue
Block a user