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


C++ model::notify_list方法代码示例

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


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

示例1: read_notify_list

	void read_notify_list(model& aModel, std::function<bool()> aErrorFunction)
	{
		notify& theNotifyList = aModel.notify_list();

		neolib::xml xmlNotifyList(true);
		std::ifstream input((aModel.root_path() + "notify_list.xml").c_str());
		xmlNotifyList.read(input);

		if (xmlNotifyList.error() && aErrorFunction && aErrorFunction())
		{
			theNotifyList.entries().clear();
			write_notify_list(aModel);
			return;
		}

		theNotifyList.loading(true);

		for (neolib::xml::element::const_iterator i = xmlNotifyList.root().begin(); i != xmlNotifyList.root().end(); ++i)
		{
			if (i->name() == "entry")
			{
				notify_entry_ptr e(new notify_entry);
				for (neolib::xml::element::const_iterator j = i->begin(); j != i->end(); ++j)
				{
					if (j->name() == "user")
						e->user() = user(j->attribute_value("value"), casemapping::rfc1459, false, true);
					if (j->name() == "server_network" || j->name() == "server_group")
						e->server().first = j->attribute_value("value");
					if (j->name() == "server_name")
						e->server().second = j->attribute_value("value");
					if (j->name() == "channel")
						e->channel() = j->attribute_value("value");
					if (j->name() == "action")
						e->action() = static_cast<notify_entry::action_e>(neolib::string_to_integer<char>(j->attribute_value("value")));
					if (j->name() == "event")
						e->event() = static_cast<notify_entry::event_e>(neolib::string_to_integer<char>(j->attribute_value("value")));
					if (j->name() == "data")
						e->data() = j->attribute_value("value");
				}
				if (e->user().nick_name().empty())
					e->user().nick_name() = "*";
				if (e->channel().empty())
					e->channel() = "*";
				theNotifyList.entries().push_back(e);
			}
		}

		theNotifyList.loading(false);
	}
开发者ID:FlibbleMr,项目名称:neoirc,代码行数:49,代码来源:notify.cpp

示例2: write_notify_list

	void write_notify_list(const model& aModel)
	{
		const notify& theNotifyList = aModel.notify_list();

		neolib::xml xmlNotifyList(true);

		xmlNotifyList.root().name() = "notify_list";

		for (notify::container_type::const_iterator i = theNotifyList.entries().begin(); i != theNotifyList.entries().end(); ++i)
		{
			const notify_entry& entry = **i;
			neolib::xml::element& xmlEntry = xmlNotifyList.append(xmlNotifyList.root(), "entry");
			xmlNotifyList.append(xmlEntry, "user").set_attribute("value", entry.user().msgto_form());
			xmlNotifyList.append(xmlEntry, "server_network").set_attribute("value", entry.server().first);
			xmlNotifyList.append(xmlEntry, "server_name").set_attribute("value", entry.server().second);
			xmlNotifyList.append(xmlEntry, "channel").set_attribute("value", entry.channel());
			xmlNotifyList.append(xmlEntry, "action").set_attribute("value", neolib::integer_to_string<char>(entry.action()));
			xmlNotifyList.append(xmlEntry, "event").set_attribute("value", neolib::integer_to_string<char>(entry.event()));
			xmlNotifyList.append(xmlEntry, "data").set_attribute("value", entry.data());
		}

		std::ofstream output((aModel.root_path() + "notify_list.xml").c_str());
		xmlNotifyList.write(output);
	}
开发者ID:FlibbleMr,项目名称:neoirc,代码行数:24,代码来源:notify.cpp


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