本文整理汇总了C++中KObjectRef::HasProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ KObjectRef::HasProperty方法的具体用法?C++ KObjectRef::HasProperty怎么用?C++ KObjectRef::HasProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KObjectRef
的用法示例。
在下文中一共展示了KObjectRef::HasProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
AutoPtr<PreprocessData> Script::Preprocess(const char *url, KObjectRef scope)
{
KObjectRef evaluator = this->FindEvaluatorWithMethod("canPreprocess", url);
if (!evaluator.isNull())
{
KMethodRef preprocess = evaluator->GetMethod("preprocess");
if (!preprocess.isNull())
{
ValueList args;
args.push_back(Value::NewString(url));
args.push_back(Value::NewObject(scope));
KValueRef result = preprocess->Call(args);
if (result->IsObject())
{
KObjectRef object = result->ToObject();
AutoPtr<PreprocessData> data = new PreprocessData();
if (object->HasProperty("data"))
{
KValueRef objectData = object->Get("data");
if (objectData->IsObject())
{
BlobRef blobData = objectData->ToObject().cast<Blob>();
if (!blobData.isNull())
{
data->data = blobData;
}
}
else if (objectData->IsString())
{
data->data = new Blob(objectData->ToString(), strlen(objectData->ToString()));
}
}
else
{
throw ValueException::FromString("Preprocessor didn't return any data");
}
if (object->HasProperty("mimeType"))
{
data->mimeType = object->Get("mimeType")->ToString();
}
else
{
throw ValueException::FromString("Preprocessor didn't return a mimeType");
}
return data;
}
}
else
{
throw ValueException::FromFormat(
"Error preprocessing: No \"preprocess\" method found on evaluator for url: \"%s\"", url);
}
}
else
{
throw ValueException::FromFormat("Error preprocessing: No evaluator found for url: \"%s\"", url);
}
return 0;
}