当前位置: 首页>>代码示例>>C++>>正文


C++ PObject类代码示例

本文整理汇总了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;
}
开发者ID:czeidler,项目名称:ALEditor,代码行数:33,代码来源:PObjectBroker.cpp

示例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
开发者ID:boubad,项目名称:cppgeninfo,代码行数:29,代码来源:person.cpp

示例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;
}
开发者ID:HaikuArchives,项目名称:PDesigner,代码行数:34,代码来源:PTextView.cpp

示例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;
    }
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:33,代码来源:controller.cpp

示例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;
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:56,代码来源:controller.cpp

示例6:

void
PTextViewBackend::AttachedToWindow(void)
{
	PArgs in, out;
	EventData *data = fOwner->FindEvent("AttachedToWindow");
	if (data->hook)
		fOwner->RunEvent(data, in, out);
	else
		BTextView::AttachedToWindow();
}
开发者ID:HaikuArchives,项目名称:PDesigner,代码行数:10,代码来源:PTextView.cpp

示例7:

void
PProgressBarBackend::Pulse()
{
	PArgs in, out;
	EventData *data = fOwner->FindEvent("Pulse");
	if (data->hook)
		fOwner->RunEvent(data, in, out);
	else
		BStatusBar::Pulse();
}
开发者ID:HaikuArchives,项目名称:PDesigner,代码行数:10,代码来源:PProgressBar.cpp

示例8:

void
PRadioButtonBackend::DetachedFromWindow(void)
{
	PArgs in, out;
	EventData *data = fOwner->FindEvent("DetachedFromWindow");
	if (data->hook)
		fOwner->RunEvent(data, in, out);
	else
		BRadioButton::DetachedFromWindow();
}
开发者ID:HaikuArchives,项目名称:PDesigner,代码行数:10,代码来源:PRadioButton.cpp

示例9:

void
PLabelBackend::AllDetached(void)
{
	PArgs in, out;
	EventData *data = fOwner->FindEvent("AllDetached");
	if (data->hook)
		fOwner->RunEvent(data, in, out);
	else
		BStringView::AllDetached();
}
开发者ID:HaikuArchives,项目名称:PDesigner,代码行数:10,代码来源:PLabel.cpp

示例10:

void
PListViewBackend::AllAttached(void)
{
	PArgs in, out;
	EventData *data = fOwner->FindEvent("AllAttached");
	if (data->hook)
		fOwner->RunEvent(data, in, out);
	else
		BListView::AllAttached();
}
开发者ID:HaikuArchives,项目名称:PDesigner,代码行数:10,代码来源:PListView.cpp


注:本文中的PObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。