#ifndef __MOCKCPP_API_HOOK_GENERATOR_H__ #define __MOCKCPP_API_HOOK_GENERATOR_H__ #include MOCKCPP_NS_START ///////////////////////////////////////////////////////////////// template struct ApiHookGenerator { static void* findApiHook(F api) { void* hook; (hook = ApiHookFunctor::getApiHook(api)) || (hook = ApiHookGenerator::findApiHook(api)); return hook; } static void* appyApiHook(F api) { void* hook; (hook = ApiHookFunctor::applyApiHook(api)) || (hook = ApiHookGenerator::appyApiHook(api)); return hook; } static bool freeApiHook(void* hook) { return (ApiHookFunctor::freeApiHook(hook)) || (ApiHookGenerator::freeApiHook(hook)); } private: }; ///////////////////////////////////////////////////////////////// template struct ApiHookGenerator { static void* findApiHook(F api) { return 0; } static void* appyApiHook(F api) { oss_t oss; oss << "Did you define too many mockers in a testcase? " << "Probably you should refine your design, " << "or you can reconfig ParameterizedApiHookHolder::maxSeq bigger, " << "it's the number of mockers in a testcase that with the same function prototype, " << "the bigger it is, the slower compiling is."; MOCKCPP_REPORT_FAILURE(oss.str()); return 0; } static bool freeApiHook(void* hook) { return true; } }; ///////////////////////////////////////////////////////////////// MOCKCPP_NS_END #endif