library/src/blockclass/subclasses/BP_ApplicationHelpGenerator.cc
// Builds the build version table.
Builds the build version table.
Builds the build version table .
BP_ERROR_T BP_ApplicationHelpGenerator::buildApplicationVersionTable()
{
	if(!this->sfsc)
		return ERR_FAILURE;
	char version_string[BP_KILOBYTE];
	BP_ZERO_STACK(version_string);
	sprintf(version_string, "%zu.%zu.%zu", this->app_version.major_version, this->app_version.minor_version, this->app_version.build_indicator);
	char blockparty_version_string[BP_KILOBYTE];
	BP_ZERO_STACK(blockparty_version_string);
	sprintf(blockparty_version_string, "%zu.%zu.%zu", BP_LIBRARY_MAJOR_VERSION, BP_LIBRARY_MINOR_VERSION, BP_LIBRARY_BUILD_ID);
	char *str_stack_to_join[8];
	BP_ZERO_STACK(str_stack_to_join);
	size_t idx=0;
	str_stack_to_join[idx] = (char *) "App Version:        "; idx++;
	str_stack_to_join[idx] = (char *)  version_string; idx++;
	str_stack_to_join[idx] = "\n"; idx++;
	str_stack_to_join[idx] = (char *) "Blockparty Version: "; idx++;
	str_stack_to_join[idx] = (char *) blockparty_version_string; idx++;
	char * joined_string = BP_JoinStringArray(str_stack_to_join, idx);
	if(!joined_string)
	{
		return ERR_FAILURE;
	}
	BP_COLOR_CODE_SET_T tmp_version_table_colors;
	tmp_version_table_colors.fg = BP_COLOR_CODE_FG_CYAN;
	tmp_version_table_colors.bg = BP_COLOR_CODE_BG_NONE;
	sfsc->addRowGroup();
	sfsc->addRow        ();
	sfsc->addColumnGroup();
	sfsc->addColumn     ();
	sfsc->addStringEntry
	(
			"version table",
			joined_string,
			bpstrlen(joined_string),
			0,
			&tmp_version_table_colors,
			BP_TRUE,
			1,
			0,
			&BP_STSBS_border_set_onlypadding_no_bottom_border_1
	);
	sfsc->addColumn     ();
	tmp_version_table_colors.fg = BP_COLOR_CODE_FG_GREEN;
	tmp_version_table_colors.bg = BP_COLOR_CODE_BG_NONE;
	sfsc->addStringEntry
	(
			"app build date spacer",
			"Built On:",
			bpstrlen("Built On:"),
			bpstrlen("Built On:"),
			&tmp_version_table_colors,
			BP_FALSE,
			0,
			0,
			&BP_STSBS_border_set_onlypadding_no_bottom_border_1
	);
	sfsc->addColumn     ();
	tmp_version_table_colors.fg = BP_COLOR_CODE_FG_NONE;
	tmp_version_table_colors.bg = BP_COLOR_CODE_BG_NONE;
	sfsc->addStringEntry
	(
			"app build date",
			this->app_build_date,
			bpstrlen(this->app_build_date),
			bpstrlen(this->app_build_date),
			&tmp_version_table_colors,
			BP_FALSE,
			1,
			0,
			&BP_STSBS_border_set_onlypadding_1
	);
	sfsc->addColumn();
	sfsc->addStringEntry
	(
			"app build time",
			this->app_build_time,
			bpstrlen(this->app_build_time),
			bpstrlen(this->app_build_time),
			&tmp_version_table_colors,
			BP_FALSE,
			1,
			0,
			&BP_STSBS_border_set_onlypadding_1
	);
	bpfree(joined_string);
	return ERR_SUCCESS;
}
BP_ERROR_T BP_ApplicationHelpGenerator :: buildApplicationVersionTable ( ) { if ( ! this -> sfsc ) return ERR_FAILURE ; char version_string [ BP_KILOBYTE ] ; BP_ZERO_STACK ( version_string ) ; sprintf ( version_string , " " , this -> app_version . major_version , this -> app_version . minor_version , this -> app_version . build_indicator ) ; char blockparty_version_string [ BP_KILOBYTE ] ; BP_ZERO_STACK ( blockparty_version_string ) ; sprintf ( blockparty_version_string , " " , BP_LIBRARY_MAJOR_VERSION , BP_LIBRARY_MINOR_VERSION , BP_LIBRARY_BUILD_ID ) ; char * str_stack_to_join [ 8 ] ; BP_ZERO_STACK ( str_stack_to_join ) ; size_t idx = 0 ; str_stack_to_join [ idx ] = ( char * ) " " ; idx ++ ; str_stack_to_join [ idx ] = ( char * ) version_string ; idx ++ ; str_stack_to_join [ idx ] = " \n " ; idx ++ ; str_stack_to_join [ idx ] = ( char * ) " " ; idx ++ ; str_stack_to_join [ idx ] = ( char * ) blockparty_version_string ; idx ++ ; char * joined_string = BP_JoinStringArray ( str_stack_to_join , idx ) ; if ( ! joined_string ) { return ERR_FAILURE ; } BP_COLOR_CODE_SET_T tmp_version_table_colors ; tmp_version_table_colors . fg = BP_COLOR_CODE_FG_CYAN ; tmp_version_table_colors . bg = BP_COLOR_CODE_BG_NONE ; sfsc -> addRowGroup ( ) ; sfsc -> addRow ( ) ; sfsc -> addColumnGroup ( ) ; sfsc -> addColumn ( ) ; sfsc -> addStringEntry ( " " , joined_string , bpstrlen ( joined_string ) , 0 , & tmp_version_table_colors , BP_TRUE , 1 , 0 , & BP_STSBS_border_set_onlypadding_no_bottom_border_1 ) ; sfsc -> addColumn ( ) ; tmp_version_table_colors . fg = BP_COLOR_CODE_FG_GREEN ; tmp_version_table_colors . bg = BP_COLOR_CODE_BG_NONE ; sfsc -> addStringEntry ( " " , " " , bpstrlen ( " " ) , bpstrlen ( " " ) , & tmp_version_table_colors , BP_FALSE , 0 , 0 , & BP_STSBS_border_set_onlypadding_no_bottom_border_1 ) ; sfsc -> addColumn ( ) ; tmp_version_table_colors . fg = BP_COLOR_CODE_FG_NONE ; tmp_version_table_colors . bg = BP_COLOR_CODE_BG_NONE ; sfsc -> addStringEntry ( " " , this -> app_build_date , bpstrlen ( this -> app_build_date ) , bpstrlen ( this -> app_build_date ) , & tmp_version_table_colors , BP_FALSE , 1 , 0 , & BP_STSBS_border_set_onlypadding_1 ) ; sfsc -> addColumn ( ) ; sfsc -> addStringEntry ( " " , this -> app_build_time , bpstrlen ( this -> app_build_time ) , bpstrlen ( this -> app_build_time ) , & tmp_version_table_colors , BP_FALSE , 1 , 0 , & BP_STSBS_border_set_onlypadding_1 ) ; bpfree ( joined_string ) ; return ERR_SUCCESS ; }
Builds the build version table.
Builds the build version table .
// create version string and zero it out // set the app version string // create room for blockparty version string // set the blockparty build indicator // create a string stack we can join up easily // fill in the blanks // join the string array into a single string // destroy the joined string // return indicating success