#include "report-data-html.h"

void init_div(struct tag_attr *div_attr, const std::string &css_class, const std::string &css_id)
{
	div_attr->css_class=css_class;
	div_attr->css_id=css_id;
}

void
init_top_table_attr(struct table_attributes *table_css, const int rows, const int cols){
	table_css->pos_table_title=L;
	table_css->table_class="emphasis1";
	table_css->th_class="table_sysinfo";
	table_css->td_class="";
	table_css->tr_class="";
	table_css->title_mod=0;
	table_css->rows=rows;
	table_css->cols=cols;
}

void init_title_attr(struct tag_attr *title_attr)
{
	title_attr->css_class="content_title";
	title_attr->css_id="";
}

void init_std_table_attr(struct table_attributes *table_css, const int rows, const int cols){
	table_css->table_class="emphasis2";
	table_css->tr_class="emph1";
	table_css->th_class="emph_title";
	table_css->td_class="";
	table_css->pos_table_title=T;
	table_css->title_mod=0;
	table_css->rows=rows;
	table_css->cols=cols;
}
void init_std_side_table_attr(struct table_attributes *table_css, const int rows, const int cols){
	table_css->table_class="emphasis2 side_by_side_left";
	table_css->tr_class="emph1";
	table_css->th_class="emph_title";
	table_css->td_class="";
	table_css->pos_table_title=T;
	table_css->title_mod=0;
	table_css->rows=rows;
	table_css->cols=cols;
}


void init_pkg_table_attr(struct table_attributes *table_css, const int rows, const int cols){
	table_css->table_class="emphasis2 side_by_side_left";
	table_css->tr_class="";
	table_css->th_class="title";
	table_css->td_class="package";
	table_css->pos_table_title=T;
	table_css->title_mod=0;
	table_css->rows=rows;
	table_css->cols=cols;
}

void init_core_table_attr(struct table_attributes *table_css, const int title_mod,
		const int rows, const int cols){
	table_css->table_class="emphasis2 side_by_side_left";
	table_css->tr_class="";
	table_css->th_class="title";
	table_css->td_class="core";
	table_css->pos_table_title=TC;
	table_css->title_mod=title_mod;
	table_css->rows=rows;
	table_css->cols=cols;
}

void init_cpu_table_attr(struct table_attributes *table_css, const int title_mod,
		const int rows, const int cols){
	table_css->table_class="emphasis2 side_by_side_left";
	table_css->tr_class="";
	table_css->th_class="title";
	table_css->td_class="cpu";
	table_css->pos_table_title=TLC;
	table_css->title_mod=title_mod;
	table_css->rows=rows;
	table_css->cols=cols;
}


void init_nowarp_table_attr(struct table_attributes *table_css, const int rows, const int cols){
	table_css->table_class="emphasis2";
	table_css->tr_class="emph1";
	table_css->th_class="emph_title";
	table_css->td_class="no_wrap";
	table_css->pos_table_title=T;
	table_css->title_mod=0;
	table_css->rows=rows;
	table_css->cols=cols;
}

void init_tune_table_attr(struct table_attributes *table_css, const int rows, const int cols){
	table_css->table_class="emphasis2";
	table_css->tr_class="tune";
	table_css->th_class="emph_title";
	table_css->td_class="";
	table_css->pos_table_title=T;
	table_css->title_mod=0;
	table_css->rows=rows;
	table_css->cols=cols;
}

void init_wakeup_table_attr(struct table_attributes *table_css, const int rows, const int cols){
	table_css->table_class="emphasis2";
	table_css->tr_class="tune";
	table_css->th_class="emph_title";
	table_css->td_class="";
	table_css->pos_table_title=T;
	table_css->title_mod=0;
	table_css->rows=rows;
	table_css->cols=cols;
}

/* Other Helper Functions */
std::string
double_to_string(const double dval)
{
	std::ostringstream dtmp;
	dtmp << dval;
	std::string str = dtmp.str();
	const auto dot = str.find('.');
	if (dot != std::string::npos)
		str = str.substr(0, dot + 2);
	return str;
}


