本文整理汇总了C++中PObject::GetType方法的典型用法代码示例。如果您正苦于以下问题:C++ PObject::GetType方法的具体用法?C++ PObject::GetType怎么用?C++ PObject::GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PObject
的用法示例。
在下文中一共展示了PObject::GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
PObject *
PObjectBroker::MakeObject(const char *type, BMessage *msg)
{
if (!type)
return NULL;
if (pApp && BString(type).ICompare("PApplication") == 0)
return pApp;
PObjectInfo *info = NULL;
for (int32 i = 0; i < fObjInfoList->CountItems(); i++)
{
PObjectInfo *temp = fObjInfoList->ItemAt(i);
if (temp->type.ICompare(type) == 0)
{
info = temp;
break;
}
}
if (info)
{
PObject *obj = msg ? (PObject*)info->arcfunc(msg) : info->createfunc();
fObjectList->AddItem(obj);
if (!pApp && obj->GetType().Compare("PApplication") == 0)
pApp = obj;
return obj;
}
return NULL;
}
示例2:
int32_t
PTextViewCut(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BTextView *backend = (BTextView*)parent->GetView();
PArgs *inArgs = static_cast<PArgs*>(in);
uint64 id = 0;
if (inArgs->FindInt64("clipid", (int64*)&id) != B_OK)
return B_ERROR;
PObject *obj = BROKER->FindObject(id);
if (!obj || obj->GetType().ICompare("PClipboard") != 0)
return B_BAD_DATA;
PClipboard *clip = dynamic_cast<PClipboard*>(obj);
if (backend->Window())
backend->Window()->Lock();
backend->Cut(clip->GetBackend());
if (backend->Window())
backend->Window()->Unlock();
return B_OK;
}