示例#1
0
String GatherTpp::QtfAsHtml(const char *qtf, Index<String>& css,
                 const VectorMap<String, String>& links,
                 const VectorMap<String, String>& labels,
                 const String& outdir, const String& fn)
{
	return EncodeHtml(ParseQTF(qtf), css, links, labels, outdir, fn, Zoom(8, 40), escape, 40);
}
示例#2
0
文件: main.cpp 项目: knyazsergei/OOP
int main()
{

	std::string base;
	std::string line;

	while (getline(std::cin, line) && line != "")
	{
		base.append(line);
	}

	EncodeHtml(base);
	std::cout << base;
	return EXIT_SUCCESS;
}
示例#3
0
void bigmailer::onSend()
{
	const String enter = "\r\n" ;
	if (messagePage.editor.IsModified())
		messagePage.Save() ;
	// mapa de los campos
	VectorMap<String, int> fldMap ;
	for (int i = 0; i < theDefList.fields.GetCount(); i++)
		fldMap.Add(theDefList.fields[i], i) ;

	String outHTML ;

	Index<String> css ;
	VectorMap<String, String> links ;
	String path = "./" ;
 	String html = EncodeHtml(messagePage.editor.Get(), css, links, path ) ;

	outHTML <<
		"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\r\n"
		"<html>\r\n"
		"<head>\r\n"
		"<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n"
		"<style>\r\n"
		<< AsCss( css ) << "\r\n"
		<< "</style>\r\n"
	     "</head>\r\n"
		   "<body>\r\n"
		<< html << "\r\n"
		<< "</body>\r\n"
		   "</html>\r\n" ;

	Progress prog ;
	prog.Set(0, theDefList.data.GetCount()) ;
	prog.Show() ;

	theDefList.errors.Clear() ;

	String theHtml ;
	for (int row = 0; row < theDefList.data.GetCount(); row++)
	{
		String addrTo = theDefList.data[row][1] ;
		if (addrTo.IsEmpty())
		{
			theDefList.errors.Add(t_("dirección incorrecta")) ;
			continue ;
		}

		if (prog.Canceled())
			break ;


		theHtml = outHTML ;

		String s = AsString(row+1) + " / " + AsString( theDefList.data.GetCount() ) ;
		prog.SetText(s) ;

		for (int i = 0; i < theDefList.fields.GetCount(); i++)
		{
			String toFind = "[%" + theDefList.fields[i] + "%]" ;
			int from = 0 ;
			while( (from = theHtml.Find(toFind, from )) != -1)
			{
				theHtml.Remove( from, toFind.GetCount() ) ;
				theHtml.Insert( from, theDefList.data[row][ fldMap.Get(theDefList.fields[i])] ) ;
			}
		}

		prog.SetPos(row+1) ;

		SmtpMailEx mail ;

		mail.Host( theCfg.smtpServer )
				.User( theCfg.user )
				.Password( theCfg.pass )
				.From( theMsg.from )
				.ReplyTo( theMsg.from )
				.To( addrTo )
				.Subject( theMsg.subject )
				.Text( "" )
		    .Attach("MENSAJE", theHtml, "text/html; charset=utf-8") ;

		if ( ! mail.Send() )
			theDefList.errors.Add(mail.GetError()) ;
		else
			theDefList.errors.Add("OK") ;

	}

	theDefList.Save() ;
}