本文整理汇总了C++中JSBClass::GetFunctions方法的典型用法代码示例。如果您正苦于以下问题:C++ JSBClass::GetFunctions方法的具体用法?C++ JSBClass::GetFunctions怎么用?C++ JSBClass::GetFunctions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSBClass
的用法示例。
在下文中一共展示了JSBClass::GetFunctions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findFunctionInBase
JSBFunction* JSBHaxe::findFunctionInBase(JSBFunction* function) {
PODVector<JSBClass*>& base = function->GetClass()->GetBaseClasses();
for (unsigned j = 0; j < base.Size(); j++)
{
JSBClass* klass = base[j];
PODVector<JSBFunction*>& functions = klass->GetFunctions();
for (unsigned j = 0; j < functions.Size(); j++)
{
JSBFunction* func = functions[j];
if (func->IsConstructor() || func->IsDestructor() )
continue;
if (func->GetName() == function->GetName()) {
return func;
}
}
}
return NULL;
}
示例2: ExportModuleClasses
void JSBHaxe::ExportModuleClasses(JSBModule* module)
{
Vector<SharedPtr<JSBClass>> classes = module->GetClasses();
if (!classes.Size())
return;
source_ += "\n";
for (unsigned i = 0; i < classes.Size(); i++)
{
JSBClass* klass = classes.At(i);
if (klass->IsNumberArray()) {
source_ += "typedef " + klass->GetName() + " = Array<Float>;\n";
continue;
}
source_ += "@:native(\"Atomic." + klass->GetName() + "\")\n";
source_ += "extern class " + klass->GetName();
JSBClass* base = klass->GetBaseClass();
if (base)
{
source_ += " extends " + base->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_->GetReturnType();
}
else if (prop->setter_ && !prop->setter_->Skip())
ftype = prop->setter_->GetParameters()[0];
if (!ftype)
continue;
String scriptType = GetScriptType(ftype);
String scriptName = prop->GetCasePropertyName();
if (!checkV(klass, scriptName, scriptType)) {
//rename haxe reserved words
if (scriptName == "override") {
scriptName = "overide";
}
if (scriptName == "dynamic") {
scriptName = "dynamik";
}
source_ += " var " + scriptName + ": " + scriptType + ";\n";
}
}
if (propertyNames.Size())
source_ += "\n";
JSBFunction* constructor = klass->GetConstructor();
if (constructor)
{
ExportFunction(constructor);
source_ += "\n";
}
PODVector<JSBFunction*>& functions = klass->GetFunctions();
for (unsigned j = 0; j < functions.Size(); j++)
{
JSBFunction* func = functions[j];
if (func->IsConstructor() || func->IsDestructor() || func->Skip())
continue;
ExportFunction(func);
}
for (unsigned j = 0; j < klass->GetNumHaxeDecl(); j++)
{
source_ += " " + klass->GetHaxeDecl(j) + "\n";
}
source_ += "\n}\n\n";
}
//.........这里部分代码省略.........
示例3: ExportModuleClasses
void JSBTypeScript::ExportModuleClasses(JSBModule* module)
{
Vector<SharedPtr<JSBClass>> classes = module->GetClasses();
if (!classes.Size())
return;
source_ += "\n";
for (unsigned i = 0; i < classes.Size(); i++)
{
JSBClass* klass = classes.At(i);
source_ += " export class " + klass->GetName();
JSBClass* base = klass->GetBaseClass();
if (base)
{
if (klass->GetPackage() != base->GetPackage())
{
source_ += " extends " + base->GetPackage()->GetName() + "." + base->GetName();
}
else
{
source_ += " extends " + base->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_->GetReturnType();
}
else if (prop->setter_ && !prop->setter_->Skip())
ftype = prop->setter_->GetParameters()[0];
if (!ftype)
continue;
String scriptType = GetScriptType(ftype);
String scriptName = prop->GetCasePropertyName();
source_ += " " + scriptName + ": " + scriptType + ";\n";
}
if (propertyNames.Size())
source_ += "\n";
JSBFunction* constructor = klass->GetConstructor();
if (constructor)
{
ExportFunction(constructor);
source_ += "\n";
}
PODVector<JSBFunction*>& functions = klass->GetFunctions();
for (unsigned j = 0; j < functions.Size(); j++)
{
JSBFunction* func = functions[j];
if (func->IsConstructor() || func->IsDestructor() || func->Skip())
continue;
ExportFunction(func);
}
for (unsigned j = 0; j < klass->GetNumTypeScriptDecl(); j++)
{
source_ += " " + klass->GetTypeScriptDecl(j) + "\n";
}
source_ += "\n }\n\n";
}
source_ += "\n";
}