示例#1
0
void Utility::copyDeltaProperties(const Poco::Util::AbstractConfiguration& ref, const Poco::Util::AbstractConfiguration& source, Poco::Util::AbstractConfiguration& target, const std::set<std::string>& excludeSet, const std::string& root)
{
	Poco::Util::AbstractConfiguration::Keys keys;
	source.keys(root, keys);

	if (keys.empty() && source.hasProperty(root))
	{
		if ((ref.hasProperty(root) && ref.getRawString(root) != source.getRawString(root)) || !ref.hasProperty(root))
		{
			target.setString(root, source.getRawString(root));
		}
	}
	else
	{
		for (Poco::Util::AbstractConfiguration::Keys::const_iterator it = keys.begin(); it != keys.end(); ++it)
		{
			std::string fullKey = root;
			if (!fullKey.empty()) fullKey += '.';
			fullKey.append(*it);
			if (excludeSet.find(fullKey) == excludeSet.end())
			{
				copyDeltaProperties(ref, source, target, excludeSet, fullKey);
			}
		}
	}
}