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


C++ SimpleXML类代码示例

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


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

示例1: if

RSSFeed::RssFormat RSSFeed::DetectRSSFormat(void* data, RSSParser parser)
{
	if (parser == XML_PARSER)
	{
		XMLParser::XMLNode* rootNode = reinterpret_cast<XMLParser::XMLNode*>(data);
		if (rootNode != nullptr)
		{
			// Start Detection
			XMLParser::XMLNode rssNode = rootNode->getChildNode("rss");
			if (!rssNode.isEmpty())
			{
				return RSS_2_0;
			}
			XMLParser::XMLNode atomNode = rootNode->getChildNode("feed");
			if (!atomNode.isEmpty())
			{
				return RSS_ATOM;
			}
		}
	}
	else if (parser == XML_SIMPLE)
	{
		SimpleXML* xml = reinterpret_cast<SimpleXML*>(data);
		if (xml != nullptr)
		{
			if (xml->findChild("rss")) return RSS_2_0;
			if (xml->findChild("feed")) return RSS_ATOM;
		}
	}
	return RSS_2_0;
}
开发者ID:aleksei-t,项目名称:flylinkdc-r5xx,代码行数:31,代码来源:RSSManager.cpp

示例2: saveNodes

	/*
	 * Save bootstrap nodes to disk
	 */
	void KBucket::saveNodes(SimpleXML& xml)
	{
		xml.addTag("Nodes");
		xml.stepIn();

		// get 50 random nodes to bootstrap from them next time
		Node::Map closestToMe;
		getClosestNodes(CID::generate(), closestToMe, 50, 3);

		for(Node::Map::const_iterator j = closestToMe.begin(); j != closestToMe.end(); j++)
		{
			const Node::Ptr& node = j->second;

			xml.addTag("Node");
			xml.addChildAttrib("CID", node->getUser()->getCID().toBase32());
			xml.addChildAttrib("type", node->getType());
			xml.addChildAttrib("verified", node->isIpVerified());

			if(!node->getUDPKey().key.isZero() && !node->getUDPKey().ip.empty())
			{
				xml.addChildAttrib("key", node->getUDPKey().key.toBase32());
				xml.addChildAttrib("keyIP", node->getUDPKey().ip);
			}

			StringMap params;
			node->getIdentity().getParams(params, Util::emptyString, false, true);

			for(StringMap::const_iterator i = params.begin(); i != params.end(); i++)
				xml.addChildAttrib(i->first, i->second);
		}

		xml.stepOut();
	}
开发者ID:pk2010,项目名称:eiskaltdcpp,代码行数:36,代码来源:KBucket.cpp

示例3: f

void ResourceManager::loadLanguage(const string& aFile) {
	try {
		File f(aFile, File::READ, File::OPEN);
		SimpleXML xml;
		xml.fromXML(f.read());

		unordered_map<string, int> h;
		
		for(int i = 0; i < LAST; ++i) {
			h[names[i]] = i;
		}

		if(xml.findChild("Language")) {
			rtl = xml.getBoolChildAttrib("RightToLeft");

			xml.stepIn();
			if(xml.findChild("Strings")) {
				xml.stepIn();

				while(xml.findChild("String")) {
					unordered_map<string, int>::const_iterator j = h.find(xml.getChildAttrib("Name"));

					if(j != h.end()) {
						strings[j->second] = xml.getChildData();
					}
				}
				createWide();
			}
		}
	} catch(const Exception&) {
		// ...
	}
}
开发者ID:Dimetro83,项目名称:DC_DDD,代码行数:33,代码来源:ResourceManager.cpp

示例4: loadNodes

	/*
	 * Loads existing nodes from disk
	 */
	void KBucket::loadNodes(SimpleXML& xml)
	{
		xml.resetCurrentChild();
		if(xml.findChild("Nodes"))
		{
			xml.stepIn();
			while(xml.findChild("Node"))
			{
				CID cid			= CID(xml.getChildAttrib("CID"));
				string i4		= xml.getChildAttrib("I4");
				uint16_t u4		= static_cast<uint16_t>(xml.getIntChildAttrib("U4"));

				if(Utils::isGoodIPPort(i4, u4))
				{
					UDPKey udpKey;
					string key		= xml.getChildAttrib("key");
					string keyIp	= xml.getChildAttrib("keyIP");

					if(!key.empty() && !keyIp.empty())
					{
						udpKey.key = CID(key);
						udpKey.ip = keyIp;
					}

					//addUser(cid, i4, u4);
					BootstrapManager::getInstance()->addBootstrapNode(i4, u4, cid, udpKey);
				}
			}
			xml.stepOut();
		}
	}
开发者ID:pk2010,项目名称:eiskaltdcpp,代码行数:34,代码来源:KBucket.cpp

示例5: save

	void ServerConfig::save(SimpleXML& xml_, const string& aTagName) noexcept {
		if (!hasValidConfig()) {
			return;
		}

		xml_.addTag(aTagName);
		xml_.addChildAttrib("Port", port);
	}
开发者ID:jameskumar,项目名称:airgit,代码行数:8,代码来源:WebServerManager.cpp

示例6: load

void IgnoreManager::load(SimpleXML& aXml) {
	if(aXml.findChild("IgnoreList")) {
		aXml.stepIn();
		while(aXml.findChild("User")) {	
			ignoredUsers.insert(Text::toT(aXml.getChildAttrib("Nick")));
		}
		aXml.stepOut();
	}
}
开发者ID:BackupTheBerlios,项目名称:airdc-svn,代码行数:9,代码来源:IgnoreManager.cpp

示例7: save

void IgnoreManager::save(SimpleXML& aXml) {
	aXml.addTag("IgnoreList");
	aXml.stepIn();

	for(TStringHashIterC i = ignoredUsers.begin(); i != ignoredUsers.end(); ++i) {
		aXml.addTag("User");
		aXml.addChildAttrib("Nick", Text::fromT(*i));
	}
	aXml.stepOut();
}
开发者ID:BackupTheBerlios,项目名称:airdc-svn,代码行数:10,代码来源:IgnoreManager.cpp

示例8: l

void IpGuard::save()
{
	Lock l(cs);
	
	SimpleXML xml;
	xml.addTag("IpRanges");
	xml.stepIn();
	for (RangeIter i = ranges.begin(); i != ranges.end(); ++i)
	{
		xml.addTag("Range");
		xml.addChildAttrib("Start", Util::toString(i->start.iIP));
		xml.addChildAttrib("End", Util::toString(i->end.iIP));
		xml.addChildAttrib("Comment", i->name);
	}
	xml.stepOut();
	
	try
	{
		string fname = Util::getPath(Util::PATH_USER_CONFIG) + "IPGuard.xml";
		
		File f(fname + ".tmp", File::WRITE, File::CREATE | File::TRUNCATE);
		f.write(SimpleXML::utf8Header);
		f.write(xml.toXML());
		f.close();
		File::deleteFile(fname);
		File::renameFile(fname + ".tmp", fname);
	}
	catch (const Exception& e)
	{
		dcdebug("IpGuard::save: %s\n", e.getError().c_str());
	}
}
开发者ID:3F,项目名称:FlightSDCpp,代码行数:32,代码来源:IpGuard.cpp

示例9: save

void ShareManager::save(SimpleXML& aXml) {
	Lock l(cs);

	aXml.addTag("Share");
	aXml.stepIn();
	for(auto& i: shares) {
		aXml.addTag("Directory", i.first);
		aXml.addChildAttrib("Virtual", i.second);
	}
	aXml.stepOut();
}
开发者ID:bmdc-team,项目名称:bmdc,代码行数:11,代码来源:ShareManager.cpp

示例10: WatchLoad

void IpManager::WatchLoad() {
	try {
		SimpleXML xml;
		xml.fromXML(File(Util::getPath(Util::PATH_USER_CONFIG) + "IPWatch.xml", File::READ, File::OPEN).read());
		if(xml.findChild("IPWatch")) {
			xml.stepIn();
			loadWatch(xml);
			xml.stepOut();
		}
	} catch(const Exception& e) {
		dcdebug("IpManager::WatchLoad: %s\n", e.getError().c_str());
	}	
}
开发者ID:BackupTheBerlios,项目名称:rsxplusplus-svn,代码行数:13,代码来源:IpManager.cpp

示例11: load

void HubSettings::load(SimpleXML& xml) {
	for(uint8_t i = 0; i < StringCount; ++i) {
		strings[i] = xml.getChildAttrib(stringNames[i]);
	}
	for(uint8_t i = 0; i < BoolCount; ++i) {
		bools[i] = to3boolXml(xml.getIntChildAttrib(boolNames[i]));
	}
	for(uint8_t i = 0; i < IntCount; ++i) {
		auto tmp = xml.getChildAttrib(intNames[i]);
		if (!tmp.empty())
			ints[i] = Util::toInt(tmp);
	}
}
开发者ID:pavel-pimenov,项目名称:airgit,代码行数:13,代码来源:HubSettings.cpp

示例12: on

	void WebUserManager::on(WebServerManagerListener::LoadSettings, SimpleXML& xml_) noexcept {
		if (xml_.findChild("WebUsers")) {
			xml_.stepIn();
			while (xml_.findChild("WebUser")) {
				const auto& username = xml_.getChildAttrib("Username");
				const auto& password = xml_.getChildAttrib("Password");

				if (username.empty() || password.empty()) {
					continue;
				}

				const auto& permissions = xml_.getChildAttrib("Permissions");

				// Set as admin mainly for compatibility with old accounts if no permissions were found
				auto user = std::make_shared<WebUser>(username, password, permissions.empty());

				user->setLastLogin(xml_.getIntChildAttrib("LastLogin"));
				if (!permissions.empty()) {
					user->setPermissions(permissions);
				}

				users.emplace(username, user);

			}
			xml_.stepOut();
		}

		xml_.resetCurrentChild();
	}
开发者ID:Caraul,项目名称:airgit,代码行数:29,代码来源:WebUserManager.cpp

示例13: load

void RSSManager::load(SimpleXML& aXml)
{
	{
		CFlyLock(g_csFeed);
		aXml.resetCurrentChild();
		if (aXml.findChild("Rss"))
		{
			aXml.stepIn();
			while (aXml.findChild("Feed"))
			{
				const string& realURL = aXml.getChildData();
				if (realURL.empty())
				{
					continue;
				}
				const string& sourceName = aXml.getChildAttrib("Name");
				const string& codeingType = aXml.getChildAttrib("Codeing");
				
				const size_t iCodeingType = Util::toInt(codeingType);
				
				// add only unique RSS feeds
				addNewFeed(realURL, sourceName, getCodeing(iCodeingType));
			}
			aXml.stepOut();
		}
	}
	updateFeeds();
}
开发者ID:aleksei-t,项目名称:flylinkdc-r5xx,代码行数:28,代码来源:RSSManager.cpp

示例14: loadActionRaws

void RawManager::loadActionRaws() {
	try {
		SimpleXML xml;
		xml.fromXML(File(Util::getPath(Util::PATH_USER_CONFIG) + "Raws.xml", File::READ, File::OPEN).read());
		
		if(xml.findChild("ActionRaws")) {
			xml.stepIn();
			loadActionRaws(xml);
			xml.stepOut();
		}
	} catch(const Exception& e) {
		dcdebug("RawManager::loadActionRaws: %s\n", e.getError().c_str());
	}
}
开发者ID:BackupTheBerlios,项目名称:rsxplusplus-svn,代码行数:14,代码来源:RawManager.cpp

示例15: l

void ClientManager::saveUsers() const {
	try {
		SimpleXML xml;
		xml.addTag("Users");
		xml.stepIn();

		{
			Lock l(cs);
			for(auto& i: nicks) {
				if(i.second.second) {
					xml.addTag("User");
					xml.addChildAttrib("CID", i.first.toBase32());
					xml.addChildAttrib("Nick", i.second.first);
				}
			}
		}

		xml.stepOut();

		const string fName = getUsersFile();
		File out(fName + ".tmp", File::WRITE, File::CREATE | File::TRUNCATE);
		BufferedOutputStream<false> f(&out);
		f.write(SimpleXML::utf8Header);
		xml.toXML(&f);
		f.flush();
		out.close();
		File::deleteFile(fName);
		File::renameFile(fName + ".tmp", fName);
	} catch(const Exception&) { }
}
开发者ID:hjpotter92,项目名称:dcplusplus,代码行数:30,代码来源:ClientManager.cpp


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