本文整理汇总了C++中JSBClass::GetFunction方法的典型用法代码示例。如果您正苦于以下问题:C++ JSBClass::GetFunction方法的具体用法?C++ JSBClass::GetFunction怎么用?C++ JSBClass::GetFunction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSBClass
的用法示例。
在下文中一共展示了JSBClass::GetFunction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExportModuleClasses
void JSBTypeScript::ExportModuleClasses(const String& moduleName)
{
JSBModule* module = JSBindings::Instance()->GetModuleByName(moduleName);
if (!module->classes_.Size())
return;
source_ += "\n";
for (unsigned i = 0; i < module->classes_.Size(); i++)
{
JSBClass* klass = module->classes_.At(i);
source_ += " export class " + klass->GetName();
if (klass->GetBaseClass())
source_ += " extends " + klass->GetBaseClass()->GetName();
source_ += " {\n\n";
Vector<String> propertyNames;
klass->GetPropertyNames(propertyNames);
for (unsigned j = 0; j < propertyNames.Size(); j++)
{
JSBProperty* prop = klass->GetProperty(propertyNames[j]);
JSBFunctionType* ftype = NULL;
if (prop->getter_ && !prop->getter_->Skip())
{
ftype = prop->getter_->returnType_;
}
else if (prop->setter_ && !prop->setter_->Skip())
ftype = prop->setter_->parameters_[0];
if (!ftype)
continue;
String scriptType = GetScriptType(ftype);
String scriptName = propertyNames[j];
scriptName[0] = tolower(scriptName[0]);
source_ += " " + scriptName + ": " + scriptType + ";\n";
}
if (propertyNames.Size())
source_ += "\n";
JSBFunction* constructor = klass->GetConstructor();
if (constructor)
{
ExportFunction(constructor);
source_ += "\n";
}
for (unsigned j = 0; j < klass->GetFunctionCount(); j++)
{
JSBFunction* func = klass->GetFunction(j);
if (func->isConstructor_ || func->isDestructor_ || func->Skip())
continue;
ExportFunction(func);
}
source_ += "\n }\n\n";
}
source_ += "\n";
}