int InitialiseMap()
{
	if( g_mapColour.GetSize() == 0 )
	{
		for( UINT n = 0; n < countof( g_colours ); n++ )
		{
			g_mapColour.SetAt( g_colours[n].m_strName, g_colours[n].m_cr );
		}
	}
	return 1;
}
Esempio n. 2
0
void ParseStyles( const CStaticString &strStyle, CStyles &styles )
{
	if( g_mapStyle.GetSize() == 0 )
	{
		for( UINT n = 0; n < countof( g_tokens ); n++ )
		{
			g_mapStyle.SetAt( g_tokens[n].m_strName, g_tokens[n].m_style );
		}
	}

	Style style;
	CStaticString strValue;

	LPCTSTR pcszStart = strStyle;
	LPCTSTR pcszCurrent = strStyle;
	UINT uLength = strStyle.GetLength();
	while( pcszCurrent && uLength )
	{
		if( *pcszCurrent == _T(';') )
		{
			if( ExtractStyle( pcszStart, pcszCurrent - pcszStart, style, strValue ) )
			{
				CStylePair &sp = styles.Add();
				sp.m_strValue = strValue;
				sp.m_style = style;
			}
			pcszStart = pcszCurrent + 1;
		}
		pcszCurrent++;
		uLength--;
	}

	if( ExtractStyle( pcszStart, pcszCurrent - pcszStart, style, strValue ) )
	{
		CStylePair &sp = styles.Add();
		sp.m_strValue = strValue;
		sp.m_style = style;
	}


	
}