本文整理汇总了C++中JSBClass::MatchProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ JSBClass::MatchProperty方法的具体用法?C++ JSBClass::MatchProperty怎么用?C++ JSBClass::MatchProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSBClass
的用法示例。
在下文中一共展示了JSBClass::MatchProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteManagedProperties
void CSClassWriter::WriteManagedProperties(String& sourceOut)
{
String source;
if (klass_->HasProperties())
{
Vector<String> pnames;
klass_->GetPropertyNames(pnames);
for (unsigned j = 0; j < pnames.Size(); j++)
{
JSBProperty* prop = klass_->GetProperty(pnames[j]);
JSBFunctionType* fType = NULL;
JSBFunctionType* getType = NULL;
JSBFunctionType* setType = NULL;
if (CSTypeHelper::OmitFunction(prop->getter_) || CSTypeHelper::OmitFunction(prop->setter_))
continue;
if (prop->getter_ && !prop->getter_->Skip())
{
fType = getType = prop->getter_->GetReturnType();
}
if (prop->setter_ && !prop->setter_->Skip())
{
setType = prop->setter_->GetParameters()[0];
if (!fType)
fType = setType;
else if (fType->type_->ToString() != setType->type_->ToString())
continue;
}
if (!fType)
continue;
String line = klass_->IsInterface() ? "" : "public ";
JSBClass* baseClass = klass_->GetBaseClass();
if (baseClass)
{
if (baseClass->MatchProperty(prop, true))
{
// always new so we don't have to deal with virtual/override on properties
line += "new ";
}
}
String type = CSTypeHelper::GetManagedTypeString(fType, false);
line += ToString("%s %s\n", type.CString(), prop->name_.CString());
source += IndentLine(line);
source += IndentLine("{\n");
Indent();
if (prop->getter_)
{
if (klass_->IsInterface())
{
source += IndentLine("get;\n");
}
else
{
source += IndentLine("get\n");
source += IndentLine("{\n");
Indent();
source += IndentLine(ToString("return %s();\n", prop->getter_->GetName().CString()));
Dedent();
source += IndentLine("}\n");
}
}
if (prop->setter_)
{
if (klass_->IsInterface())
{
source += IndentLine("set;\n");
}
else
{
source += IndentLine("set\n");
source += IndentLine("{\n");
Indent();
source += IndentLine(ToString("%s(value);\n", prop->setter_->GetName().CString()));
Dedent();
source += IndentLine("}\n");
}
}
//.........这里部分代码省略.........