Exemple #1
0
const std::string& RA_RichPresenceInterpretter::Lookup( const std::string& sName, const std::string& sMemString ) const
{
	static std::string sReturnVal;
	sReturnVal.clear();

	//	check lookups
	for( size_t i = 0; i < m_lookups.size(); ++i )
	{
		if( m_lookups.at( i ).Description().compare( sName ) == 0 )
		{
			//	This lookup! (ugh must be non-const)
			char buffer[1024];
			sprintf_s( buffer, 1024, (char*)sMemString.c_str() );

			ValueSet nValue;
			nValue.ParseMemString( buffer );
			sReturnVal = m_lookups.at( i ).Lookup( static_cast<DataPos>( nValue.GetValue() ) );

			return sReturnVal;
		}
	}

	//	check formatters
	for( size_t i = 0; i < m_formats.size(); ++i )
	{
		if( m_formats.at( i ).Description().compare( sName ) == 0 )
		{
			//	This lookup! (ugh must be non-const)
			char buffer[1024];
			sprintf_s( buffer, 1024, (char*)sMemString.c_str() );

			ValueSet nValue;
			nValue.ParseMemString( buffer );
			sReturnVal = m_formats.at( i ).Lookup( static_cast<DataPos>( nValue.GetValue() ) );

			return sReturnVal;
		}
	}

	return sReturnVal;
}