#pragma once #include "../DefaultInclude.hpp" namespace cocos2d { class CCNode; } namespace geode { class GEODE_DLL NodeStringIDManager { public: template using Provider = void(GEODE_CALL*)(T*); protected: std::unordered_map> m_providers; public: static NodeStringIDManager* get(); template void registerProvider(std::string const& id, void(GEODE_CALL* fun)(T*)) { m_providers.insert({ id, static_cast>(fun) }); } bool provide(std::string const& id, cocos2d::CCNode* layer); }; } #define $register_ids(Layer_, Var_) \ void GEODE_CALL GEODE_CONCAT(addIDs, Layer_)(Layer_*);\ $execute {\ StringIDManager::get()->registerProvider(#Layer_, &GEODE_CONCAT(addIDs, Layer_));\ };\ void GEODE_CALL GEODE_CONCAT(addIDs, Layer_)(Layer_* Var_)