bool ClassInfo::GetClassMethods(MethodVec &ret, const ClassInfo *classInfo) { const ClassInfo::MethodVec &methods = classInfo->getMethodsVec(); ret.insert(ret.end(), methods.begin(), methods.end()); if (!(classInfo->getAttribute() & (IsInterface|IsTrait))) { const String& parentClass = classInfo->getParentClass(); if (!parentClass.empty()) { if (!GetClassMethods(ret, parentClass, 1)) return false; } } const ClassInfo::InterfaceVec &interfaces = classInfo->getInterfacesVec(); for (unsigned int i = 0; i < interfaces.size(); i++) { if (!GetClassMethods(ret, interfaces[i], 2)) return false; } return true; }
void ClassInfo::GetClassMethods(MethodVec &ret, const char *classname, int type /* = 0 */) { if (classname && *classname) { const ClassInfo *classInfo = NULL; switch (type) { case 0: classInfo = FindClass(classname); if (classInfo == NULL) { classInfo = FindInterface(classname); type = 2; } break; case 1: classInfo = FindClass(classname); break; case 2: classInfo = FindInterface(classname); break; default: ASSERT(false); } if (classInfo) { const ClassInfo::MethodVec &methods = classInfo->getMethodsVec(); ret.insert(ret.end(), methods.begin(), methods.end()); if (type != 2) { const char *parentClass = classInfo->getParentClass(); if (parentClass && *parentClass) { GetClassMethods(ret, parentClass, 1); } } const ClassInfo::InterfaceVec &interfaces = classInfo->getInterfacesVec(); for (unsigned int i = 0; i < interfaces.size(); i++) { GetClassMethods(ret, interfaces[i], 2); } } } }