Ejemplo n.º 1
5
bool DBauditConfig::parse( const config::ConfigurationNode& pt, const std::string& /*node*/,
			   const module::ModuleDirectory* /*modules*/ )
{
	using namespace config;

	bool retVal = true;
	bool reqDefined = false;
	m_config_pos = pt.position();

	for ( config::ConfigurationNode::const_iterator L1it = pt.begin(); L1it != pt.end(); L1it++ )	{
		if ( boost::algorithm::iequals( L1it->first, "required" ))	{
			if ( !Parser::getValue( logPrefix().c_str(), *L1it, m_required, Parser::BoolDomain(), &reqDefined ))
				retVal = false;
		}
		else if ( boost::algorithm::iequals( L1it->first, "database" ))	{
			bool isDefined = ( !m_dbConfig.empty() );
			if ( !Parser::getValue( logPrefix().c_str(), *L1it, m_dbConfig, &isDefined ))
				retVal = false;
		}
		else if ( boost::algorithm::iequals( L1it->first, "identifier" ))	{
			bool isDefined = ( !m_id.empty() );
			if ( !Parser::getValue( logPrefix().c_str(), *L1it, m_id, &isDefined ))
				retVal = false;
		}
		else	{
			LOG_WARNING << logPrefix() << "unknown configuration option: '"
					<< L1it->first << "' " << L1it->second.position().logtext();
		}
	}
	return retVal;
}
	bool parse( const config::ConfigurationNode& pt, const std::string& node,
			const module::ModuleDirectory*)
	{
		try
		{
			if (!m_baseptr) throw std::logic_error("configuration structure base pointer not set with setBasePtr(void*)");
			serialize::parseConfigStructureVP( m_baseptr, m_descr, pt);
			return true;
		}
		catch (const std::runtime_error& e)
		{
			LOG_ERROR << logPrefix() << e.what() << " in " << node << " " << pt.position().logtext();
			return false;
		}
	}