2023-02-25 22:58:28 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "CKDefines.hpp"
|
2023-02-27 22:23:05 +08:00
|
|
|
#include "CKEnums.hpp"
|
2023-02-25 22:58:28 +08:00
|
|
|
#include "VTEncoding.hpp"
|
|
|
|
#include <filesystem>
|
2023-02-27 22:23:05 +08:00
|
|
|
#include <map>
|
|
|
|
#include <functional>
|
2023-02-25 22:58:28 +08:00
|
|
|
|
2023-02-26 21:48:03 +08:00
|
|
|
namespace LibCmo::CK2 {
|
2023-02-25 22:58:28 +08:00
|
|
|
|
|
|
|
class CKMinContext {
|
|
|
|
public:
|
|
|
|
CKMinContext();
|
|
|
|
CKMinContext(const CKMinContext&) = delete;
|
|
|
|
CKMinContext& operator=(const CKMinContext&) = delete;
|
|
|
|
~CKMinContext();
|
|
|
|
|
2023-02-26 21:48:03 +08:00
|
|
|
using PrintCallback = void (*)(std::string&);
|
2023-02-25 22:58:28 +08:00
|
|
|
void Printf(CKSTRING fmt, ...);
|
2023-02-26 21:48:03 +08:00
|
|
|
void SetPrintCallback(PrintCallback cb);
|
2023-02-25 22:58:28 +08:00
|
|
|
|
2023-02-26 21:48:03 +08:00
|
|
|
CKObjectImplements::CKObject* CreateCKObject(CK_ID id, CK_CLASSID cls, CKSTRING name);
|
|
|
|
CKObjectImplements::CKObject* GetCKObject(CK_ID id);
|
2023-02-28 11:35:54 +08:00
|
|
|
void DestroyCKObject(CK_ID id);
|
2023-02-25 22:58:28 +08:00
|
|
|
|
2023-02-28 11:35:54 +08:00
|
|
|
//CKManagerImplements::CKBaseManager* CreateCKManager(CKGUID guid);
|
|
|
|
//CKManagerImplements::CKBaseManager* GetCKManager(CK_ID guid);
|
|
|
|
//void DestroyCKManager(CKManagerImplements::CKBaseManager* mgr);
|
|
|
|
|
|
|
|
CK_ID GetObjectMaxID(void);
|
|
|
|
void SetObjectMaxID(CK_ID id);
|
2023-02-26 21:48:03 +08:00
|
|
|
|
|
|
|
void GetUtf8String(std::string& native_name, std::string& u8_name);
|
|
|
|
void GetNativeString(std::string& u8_name, std::string& native_name);
|
2023-02-25 22:58:28 +08:00
|
|
|
|
|
|
|
void SetEncoding(CKSTRING encoding);
|
|
|
|
void SetTempPath(CKSTRING u8_temp);
|
|
|
|
|
|
|
|
FILE* OpenTempFile(CKSTRING u8_filename, bool is_read);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void RefetchEncodingToken(void);
|
|
|
|
|
2023-02-27 22:23:05 +08:00
|
|
|
std::map<CK_ID, CKObjectImplements::CKObject*> m_ObjectsList;
|
|
|
|
std::map<CK_ID, CKManagerImplements::CKBaseManager*> m_ManagersList;
|
|
|
|
|
|
|
|
std::map<CK_CLASSID, std::function<CKObjectImplements::CKObject* (CKMinContext*, CK_ID, CKSTRING)>> m_ObjectsCreationMap;
|
|
|
|
std::map<CKGUID, std::function<CKManagerImplements::CKBaseManager* (CKMinContext*, CK_ID)>> m_ManagersCreationMap;
|
|
|
|
|
2023-02-28 11:35:54 +08:00
|
|
|
CK_ID m_CKObjectMaxID;
|
|
|
|
|
2023-02-26 21:48:03 +08:00
|
|
|
std::string m_NameEncoding;
|
|
|
|
EncodingHelper::ENCODING_TOKEN m_NameEncodingToken;
|
|
|
|
std::filesystem::path m_TempFolder;
|
|
|
|
PrintCallback m_PrintCallback;
|
2023-02-25 22:58:28 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|