//this file is generated by program(drogon_ctl) automatically,don't modify it!
#include "HelloView.h"
#include <drogon/utils/OStringStream.h>
#include <drogon/utils/Utilities.h>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <list>
#include <deque>
#include <queue>
using namespace drogon;
std::string HelloView::genText(const DrTemplateData& HelloView_view_data)
{
	drogon::OStringStream HelloView_tmp_stream;
	std::string layoutName{""};
	HelloView_tmp_stream << "<!DOCTYPE html>\n";
	HelloView_tmp_stream << "<html>\n";
    auto name=HelloView_view_data.get<std::string>("name");
	bool nameIsEmpty = name == "";
	if (nameIsEmpty)
		name = "anonymous";
	auto message = "Hello, " + name + " from a CSP template";
	HelloView_tmp_stream << "<head>\n";
	HelloView_tmp_stream << "    <meta charset=\"UTF-8\">\n";
	HelloView_tmp_stream << "    <title>";
{
    auto & val=HelloView_view_data["name"];
    if(val.type()==typeid(const char *)){
        HelloView_tmp_stream<<*(std::any_cast<const char *>(&val));
    }else if(val.type()==typeid(std::string)||val.type()==typeid(const std::string)){
        HelloView_tmp_stream<<*(std::any_cast<const std::string>(&val));
    }
}
	HelloView_tmp_stream << "</title>\n";
	HelloView_tmp_stream << "</head>\n";
	HelloView_tmp_stream << "<body>\n";
	HelloView_tmp_stream << "    ";
 HelloView_tmp_stream<<message; 
	HelloView_tmp_stream << "	";
	if (nameIsEmpty)
	{
		HelloView_tmp_stream << "<br>"
			<< "You can revisit the same page and append ?name=<i>your_name</i> to change the name";
	}
	
	HelloView_tmp_stream << "</body>\n";
	HelloView_tmp_stream << "</html>\n";
if(layoutName.empty())
{
std::string ret{std::move(HelloView_tmp_stream.str())};
return ret;
}else
{
auto templ = DrTemplateBase::newTemplate(layoutName);
if(!templ) return "";
HttpViewData data = HelloView_view_data;
auto str = std::move(HelloView_tmp_stream.str());
if(!str.empty() && str[str.length()-1] == '\n') str.resize(str.length()-1);
data[""] = std::move(str);
return templ->genText(data);
}
}
