本文整理汇总了C++中PObject类的典型用法代码示例。如果您正苦于以下问题:C++ PObject类的具体用法?C++ PObject怎么用?C++ PObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PObject类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: to_lower
bool Person::add_role(const std::string &depid, const std::string &srole) {
std::string role = to_lower(trim(srole));
if (depid.empty() || role.empty()) {
return false;
}
std::vector<PersonRole> oRet = this->roles();
bool bFound = false;
PersonRole temp(depid, role);
for (auto it = oRet.begin(); it != oRet.end(); ++it) {
if ((*it) == temp) {
bFound = true;
break;
}
}
if (bFound) {
return false;
}
Array *pAr = this->set_array(DomainConstants::ROLES);
if (pAr == nullptr) {
return false;
}
PObject obj = Value::create_object();
Object *p = obj.get();
p->set_string(STRING_DEP, depid);
p->set_string(STRING_ROLE, role);
pAr->append_object(obj);
this->modified(true);
return true;
}// add_role
示例3: PTextViewCut
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;
}
示例4: id2pobject
void PukeController::MessageDispatch(int fd, PukeMessage *pm)
{
try {
/*
* Get the object id, this may produce a errorNuSuchWidget
*/
PObject *obj = id2pobject(fd, pm->iWinId);
/*
* Call the message hanlder for the widget
*/
obj->messageHandler(fd, pm);
}
catch(errorNoSuchWidget &err){
PukeMessage pmRet;
pmRet.iCommand = PUKE_INVALID;
pmRet.iWinId = pm->iWinId;
pmRet.iArg = 0;
pmRet.iTextSize = 0;
emit outputMessage(fd, &pmRet);
return;
}
catch (errorCommandFailed &err){
PukeMessage pmRet;
pmRet.iCommand = err.command();
pmRet.iWinId = pm->iWinId;
pmRet.iArg = err.iarg();
pmRet.iTextSize = 0;
emit outputMessage(fd, &pmRet);
return;
}
}
示例5: sscanf
widgetId PukeController::createWidget(widgetId wI, PukeMessage *pm)
{
widgetId wIret;
PWidget *parent = 0; // Defaults to no parent
WidgetS *ws = new WidgetS;
/*
* The parent widget ID and type are packed into the iArg
* the pattern is 2 shorts.
*/
int iParent, iType;
int found = sscanf(pm->cArg, "%d\t%d", &iParent, &iType);
if(found != 2)
throw(errorCommandFailed(PUKE_INVALID,7));
wI.iWinId = iParent; // wI is the identifier for the parent widget
if(widgetCF[iType] == NULL){ // No such widget, bail out.
wIret.fd = 0;
wIret.iWinId = 0;
throw(errorCommandFailed(PUKE_INVALID,1));
}
uiBaseWinId++; // Get a new base win id
// wIret holds the current widget id for the new widget
wIret.iWinId = uiBaseWinId;
wIret.fd = wI.fd;
if(checkWidgetId(&wI) == TRUE){
PObject *obj = WidgetList[wI.fd]->find(wI.iWinId)->pwidget;
if(obj->widget()->isWidgetType() == FALSE){
throw(errorCommandFailed(PUKE_INVALID, 0));
}
parent = (PWidget *) obj;
}
// CreateArgs arg = CreateArgs(this, pm, &wIret, parent)
CreateArgs arg(this, pm, &wIret, parent);
ws->pwidget = (widgetCF[iType]->wc)(arg);
if (ws->pwidget->hasError())
{
throw(errorCommandFailed(PUKE_INVALID, 0));
}
ws->type = iType;
connect(ws->pwidget, SIGNAL(outputMessage(int, PukeMessage*)),
this, SIGNAL(outputMessage(int, PukeMessage*)));
// insertPBoject(fd, uiBaseWinId, ws);
// The widget list has to exist since we have ourselves in the list
insertPObject(wIret.fd, wIret.iWinId, ws);
// WidgetList[wIret.fd]->insert(wIret.iWinId, ws);
return wIret;
}
示例6:
void
PTextViewBackend::AttachedToWindow(void)
{
PArgs in, out;
EventData *data = fOwner->FindEvent("AttachedToWindow");
if (data->hook)
fOwner->RunEvent(data, in, out);
else
BTextView::AttachedToWindow();
}
示例7:
void
PProgressBarBackend::Pulse()
{
PArgs in, out;
EventData *data = fOwner->FindEvent("Pulse");
if (data->hook)
fOwner->RunEvent(data, in, out);
else
BStatusBar::Pulse();
}
示例8:
void
PRadioButtonBackend::DetachedFromWindow(void)
{
PArgs in, out;
EventData *data = fOwner->FindEvent("DetachedFromWindow");
if (data->hook)
fOwner->RunEvent(data, in, out);
else
BRadioButton::DetachedFromWindow();
}
示例9:
void
PLabelBackend::AllDetached(void)
{
PArgs in, out;
EventData *data = fOwner->FindEvent("AllDetached");
if (data->hook)
fOwner->RunEvent(data, in, out);
else
BStringView::AllDetached();
}
示例10:
void
PListViewBackend::AllAttached(void)
{
PArgs in, out;
EventData *data = fOwner->FindEvent("AllAttached");
if (data->hook)
fOwner->RunEvent(data, in, out);
else
BListView::AllAttached();
}