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


C++ EventMap::insert方法代码示例

本文整理汇总了C++中EventMap::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ EventMap::insert方法的具体用法?C++ EventMap::insert怎么用?C++ EventMap::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventMap的用法示例。


在下文中一共展示了EventMap::insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: reply

void
LaunchDaemon::_HandleRegisterLaunchEvent(BMessage* message)
{
	uid_t user = _GetUserID(message);
	if (user < 0)
		return;

	if (user == 0 || fUserMode) {
		status_t status = B_OK;

		const char* name = message->GetString("name");
		const char* ownerName = message->GetString("owner");
		uint32 flags = message->GetUInt32("flags", 0);
		BMessenger source;
		if (name != NULL && ownerName != NULL
			&& message->FindMessenger("source", &source) == B_OK) {
			// Register event
			ownerName = get_leaf(ownerName);

			ExternalEventSource* event = new (std::nothrow)
				ExternalEventSource(source, ownerName, name, flags);
			if (event != NULL) {
				// Use short name, and fully qualified name
				BString eventName = name;
				fEvents.insert(std::make_pair(eventName, event));
				_ResolveExternalEvents(event, eventName);

				eventName.Prepend("/");
				eventName.Prepend(ownerName);
				fEvents.insert(std::make_pair(eventName, event));
				_ResolveExternalEvents(event, eventName);
			} else
				status = B_NO_MEMORY;
		} else
			status = B_BAD_VALUE;

		BMessage reply((uint32)status);
		message->SendReply(&reply);
	}

	_ForwardEventMessage(user, message);
}
开发者ID:garodimb,项目名称:haiku,代码行数:42,代码来源:LaunchDaemon.cpp

示例2: UpdateEventMap

	static void UpdateEventMap()
	{
		EventMap map;
		Thread::Mutex::Scoped l(locker_event);
		for(IOMap::const_iterator it = ionew.begin(), ie = ionew.end(); it != ie; ++it)
		{
			PollIO *io = (*it).second;
			iomap[(*it).first] = io;
			if (io->newevent)
				eventset.insert(io);
		}
		ionew.clear();
		for (EventSet::iterator it = eventset.begin(), ie = eventset.end(); it != ie; ++it)
		{
			map.insert( std::make_pair(*it, (*it)->event) );
			(*it)->update   = false;
			(*it)->event    = (*it)->newevent;
			(*it)->newevent = 0;
		}
		eventset.clear();
		wakeup_flag = true;
		std::for_each(map.begin(), map.end(), std::ptr_fun(&LoadEvent));
	}
开发者ID:kecookier,项目名称:Exercise,代码行数:23,代码来源:zkserver.cpp


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