Ejemplo n.º 1
0
void HTMLTemplateHandler::PerformTranslations(const std::string &text, const StringTranslation &translations, std::string &result) const
{
	std::string worktext(text);
	std::string::size_type startpos=worktext.find("{translation.");
	while(startpos!=std::string::npos)
	{
		std::string::size_type endpos=worktext.find('}',startpos);
		if(endpos!=std::string::npos)
		{
			std::string transname(worktext.substr(startpos+13,endpos-(startpos+13)));
			if(translations.IDExists(transname)==true)
			{
				worktext.replace(startpos,(endpos-startpos)+1,translations.Get(transname));
			}
		}
		startpos=worktext.find("{translation.",startpos+1);
	}
	result=worktext;
}
Ejemplo n.º 2
0
void xm_from()
{
unsigned long data_size, rsrc_size;
char text[64];

    if(receive_sync() == ACK) {
	receive_part(info, DATABYTES, 1);
	transname(info + I_NAMEOFF + 1, text, info[I_NAMEOFF]);
	define_name(text);
	data_size = get4(info + I_DLENOFF);
	rsrc_size = get4(info + I_RLENOFF);
	start_info(info, rsrc_size, data_size);
	start_data();
	receive_part(out_buffer, data_size, 1);
	start_rsrc();
	receive_part(out_buffer, rsrc_size, 0);
	end_file();
    }
}