library/src/blockclass/subclasses/BP_ApplicationHelpGenerator.cc
// Builds the application group entry options (cascades)
Builds the application group entry options (cascades)
Builds the application group entry options ( cascades )
BP_ERROR_T BP_ApplicationHelpGenerator::buildApplicationGroupEntryOptions()
{
	if(!this->sfsc)
		return ERR_FAILURE;
	if(!this->groups || ! this->group_n)
		return ERR_FAILURE;
	P_BP_AHG_OPTION_GROUP curr_group = NULL;
	P_BP_AHG_OPTION_ENTRY curr_entry = NULL;
	size_t n = 0;
	for(; n < this->group_n; n++)
	{
		curr_group = &this->groups[n];
		sfsc->addRowGroup   ();
		sfsc->addRow        ();
		sfsc->addColumnGroup();
		sfsc->addColumn     ();
		sfsc->addStringEntry("empty padding","     ",5,	5,NULL,	BP_FALSE,1,	0,NULL);
		BP_COLOR_CODE_SET_T tmp_group_name_colors;
		tmp_group_name_colors.fg = BP_COLOR_CODE_FG_GREEN;
		tmp_group_name_colors.bg = BP_COLOR_CODE_BG_BLACK;
		sfsc->addRowGroup   ();
		sfsc->addRow        ();
		sfsc->addColumnGroup();
		sfsc->addColumn     ();
		sfsc->addStringEntry
		(
			"curr_group_name",
			curr_group->group_name,
			bpstrlen(curr_group->group_name),
			bpstrlen(curr_group->group_name),
			&tmp_group_name_colors,
			BP_FALSE,
			0,
			0,
			curr_group->border_set
		);
		BP_COLOR_CODE_SET_T tmp_group_desc_colors;
		tmp_group_desc_colors.fg = BP_COLOR_CODE_FG_NONE;
		tmp_group_desc_colors.bg = BP_COLOR_CODE_BG_BLACK;
		sfsc->addColumn     ();
		sfsc->addStringEntry
		(
				"curr_group",
				curr_group->group_description,
				bpstrlen(curr_group->group_description),
				bpstrlen(curr_group->group_description),
				&tmp_group_desc_colors,
				BP_FALSE,
				0,
				0,
				curr_group->border_set
		);
		size_t longest_token = 0;
		size_t j = 0;
		for(j = 0; j < curr_group->entry_n; j++)
		{
			if(bpstrlen(curr_group->entries[j].token->token) > longest_token)
				longest_token = bpstrlen(curr_group->entries[j].token->token);
		}
		for(j = 0; j < curr_group->entry_n; j++)
		{
			curr_entry = &curr_group->entries[j];
			BP_COLOR_CODE_SET_T tmp_token_name_colors;
			tmp_token_name_colors.fg = BP_COLOR_CODE_FG_NONE;
			tmp_token_name_colors.bg = BP_COLOR_CODE_BG_NONE;
			if(curr_entry->token->token_required == BP_TRUE)
			{
				if(curr_entry->token->value_has_been_set_ok)
					tmp_token_name_colors.fg = BP_COLOR_CODE_FG_GREEN;
				else
					tmp_token_name_colors.fg = BP_COLOR_CODE_FG_RED;
			}
			sfsc->addRowGroup   ();
			sfsc->addRow        ();
			sfsc->addColumnGroup();
			sfsc->addColumn     ("token column");
			sfsc->addStringEntry
			(
					curr_entry->name,
					curr_entry->token->token,
					bpstrlen(curr_entry->token->token),
					longest_token,
					&tmp_token_name_colors,
					BP_FALSE,
					1,
					0,
					&BP_STSBS_border_set_onlypadding_3
			);
			sfsc->addColumn("description_column");
			sfsc->addStringEntry
			(
					curr_entry->token->token_description,
					curr_entry->token->token_description,
					bpstrlen(curr_entry->token->token_description),
					80,
					NULL,
					BP_FALSE,
					0,
					0,
					&BP_STSBS_border_set_onlypadding_no_bottom_border_4
			);
			char *tmp_joiner = NULL;
			if(curr_entry->token->value_has_been_set_ok != true)
			{
				if(this->clop->getDefaultValueAsCharString(curr_entry->token->token) == ERR_SUCCESS)
				if(this->clop->token_default_value_as_string)
				{
					tmp_joiner = BP_JoinStrings("Default: ", this->clop->token_default_value_as_string);
					BP_COLOR_CODE_SET_T tmp_default_value_colors;
					tmp_default_value_colors.fg = BP_COLOR_CODE_FG_YELLOW;
					tmp_default_value_colors.bg = BP_COLOR_CODE_BG_NONE;
					sfsc->addStringEntry
					(
							tmp_joiner,
							tmp_joiner,
							bpstrlen(tmp_joiner),
							bpstrlen(tmp_joiner),
							&tmp_default_value_colors,
							BP_FALSE,
							1,
							0,
							&BP_STSBS_border_set_onlypadding_no_bottom_border_4
					);
					bpfree(tmp_joiner);
				}
			}
			else
			{
				if(this->clop->getCurrentValueAsCharString(curr_entry->token->token) == ERR_SUCCESS)
				if(this->clop->token_current_value_as_string)
				{
					tmp_joiner = BP_JoinStrings("Set Val: ", this->clop->token_current_value_as_string);
					BP_COLOR_CODE_SET_T tmp_current_value_colors;
					tmp_current_value_colors.fg = BP_COLOR_CODE_FG_GREEN;
					tmp_current_value_colors.bg = BP_COLOR_CODE_BG_NONE;
					sfsc->addStringEntry
					(
							tmp_joiner,
							tmp_joiner,
							bpstrlen(tmp_joiner),
							bpstrlen(tmp_joiner),
							&tmp_current_value_colors,
							BP_FALSE,
							1,
							0,
							&BP_STSBS_border_set_onlypadding_no_bottom_border_4
					);
					bpfree(tmp_joiner);
				}
			}
			if(curr_entry->dependencies)
			{
				sfsc->addColumn();
				char *deps_str = "Mandatory Depends:";
				sfsc->addStringEntry
				(
						"deps_str",
						deps_str,
						bpstrlen(deps_str),
						bpstrlen(deps_str),
						NULL,
						BP_FALSE,
						0,
						0,
						&BP_STSBS_border_set_onlypadding_no_bottom_border_1
				);
				BP_COLOR_CODE_SET_T tmp_colors;
				tmp_colors.fg = BP_COLOR_CODE_FG_NONE;
				tmp_colors.bg = BP_COLOR_CODE_BG_NONE;
				P_BP_LINKL tmp_tq = BP_CreateLinkL(".", BP_FALSE);
				size_t l = 0;
				for(l = 0; l < curr_entry->dependency_n; l++)
				{
					tmp_colors.fg = BP_COLOR_CODE_FG_NONE;
					tmp_colors.bg = BP_COLOR_CODE_BG_NONE;
					if(curr_entry->dependencies[l].depends_how != BP_AHG_ENTRY_DEPENDENCY_MANDATORY)
						continue;
					if(curr_entry->dependencies[l].entry->token->value_has_been_set_ok == BP_TRUE)
						tmp_colors.fg = BP_COLOR_CODE_FG_GREEN;
					else
						tmp_colors.fg = BP_COLOR_CODE_FG_RED;
					sfsc->addStringEntry
					(
						"deps",
						curr_entry->dependencies[l].entry->token->token,
						bpstrlen(curr_entry->dependencies[l].entry->token->token),
						bpstrlen(curr_entry->dependencies[l].entry->token->token),
						&tmp_colors,
						BP_FALSE,
						0,
						0,
						&BP_STSBS_border_set_onlypadding_1
					);
				}
			}
		}
	}
	return ERR_SUCCESS;
}
BP_ERROR_T BP_ApplicationHelpGenerator :: buildApplicationGroupEntryOptions ( ) { if ( ! this -> sfsc ) return ERR_FAILURE ; if ( ! this -> groups || ! this -> group_n ) return ERR_FAILURE ; P_BP_AHG_OPTION_GROUP curr_group = NULL ; P_BP_AHG_OPTION_ENTRY curr_entry = NULL ; size_t n = 0 ; for ( ; n < this -> group_n ; n ++ ) { curr_group = & this -> groups [ n ] ; sfsc -> addRowGroup ( ) ; sfsc -> addRow ( ) ; sfsc -> addColumnGroup ( ) ; sfsc -> addColumn ( ) ; sfsc -> addStringEntry ( " " , " " , 5 , 5 , NULL , BP_FALSE , 1 , 0 , NULL ) ; BP_COLOR_CODE_SET_T tmp_group_name_colors ; tmp_group_name_colors . fg = BP_COLOR_CODE_FG_GREEN ; tmp_group_name_colors . bg = BP_COLOR_CODE_BG_BLACK ; sfsc -> addRowGroup ( ) ; sfsc -> addRow ( ) ; sfsc -> addColumnGroup ( ) ; sfsc -> addColumn ( ) ; sfsc -> addStringEntry ( " " , curr_group -> group_name , bpstrlen ( curr_group -> group_name ) , bpstrlen ( curr_group -> group_name ) , & tmp_group_name_colors , BP_FALSE , 0 , 0 , curr_group -> border_set ) ; BP_COLOR_CODE_SET_T tmp_group_desc_colors ; tmp_group_desc_colors . fg = BP_COLOR_CODE_FG_NONE ; tmp_group_desc_colors . bg = BP_COLOR_CODE_BG_BLACK ; sfsc -> addColumn ( ) ; sfsc -> addStringEntry ( " " , curr_group -> group_description , bpstrlen ( curr_group -> group_description ) , bpstrlen ( curr_group -> group_description ) , & tmp_group_desc_colors , BP_FALSE , 0 , 0 , curr_group -> border_set ) ; size_t longest_token = 0 ; size_t j = 0 ; for ( j = 0 ; j < curr_group -> entry_n ; j ++ ) { if ( bpstrlen ( curr_group -> entries [ j ] . token -> token ) > longest_token ) longest_token = bpstrlen ( curr_group -> entries [ j ] . token -> token ) ; } for ( j = 0 ; j < curr_group -> entry_n ; j ++ ) { curr_entry = & curr_group -> entries [ j ] ; BP_COLOR_CODE_SET_T tmp_token_name_colors ; tmp_token_name_colors . fg = BP_COLOR_CODE_FG_NONE ; tmp_token_name_colors . bg = BP_COLOR_CODE_BG_NONE ; if ( curr_entry -> token -> token_required == BP_TRUE ) { if ( curr_entry -> token -> value_has_been_set_ok ) tmp_token_name_colors . fg = BP_COLOR_CODE_FG_GREEN ; else tmp_token_name_colors . fg = BP_COLOR_CODE_FG_RED ; } sfsc -> addRowGroup ( ) ; sfsc -> addRow ( ) ; sfsc -> addColumnGroup ( ) ; sfsc -> addColumn ( " " ) ; sfsc -> addStringEntry ( curr_entry -> name , curr_entry -> token -> token , bpstrlen ( curr_entry -> token -> token ) , longest_token , & tmp_token_name_colors , BP_FALSE , 1 , 0 , & BP_STSBS_border_set_onlypadding_3 ) ; sfsc -> addColumn ( " " ) ; sfsc -> addStringEntry ( curr_entry -> token -> token_description , curr_entry -> token -> token_description , bpstrlen ( curr_entry -> token -> token_description ) , 80 , NULL , BP_FALSE , 0 , 0 , & BP_STSBS_border_set_onlypadding_no_bottom_border_4 ) ; char * tmp_joiner = NULL ; if ( curr_entry -> token -> value_has_been_set_ok != true ) { if ( this -> clop -> getDefaultValueAsCharString ( curr_entry -> token -> token ) == ERR_SUCCESS ) if ( this -> clop -> token_default_value_as_string ) { tmp_joiner = BP_JoinStrings ( " " , this -> clop -> token_default_value_as_string ) ; BP_COLOR_CODE_SET_T tmp_default_value_colors ; tmp_default_value_colors . fg = BP_COLOR_CODE_FG_YELLOW ; tmp_default_value_colors . bg = BP_COLOR_CODE_BG_NONE ; sfsc -> addStringEntry ( tmp_joiner , tmp_joiner , bpstrlen ( tmp_joiner ) , bpstrlen ( tmp_joiner ) , & tmp_default_value_colors , BP_FALSE , 1 , 0 , & BP_STSBS_border_set_onlypadding_no_bottom_border_4 ) ; bpfree ( tmp_joiner ) ; } } else { if ( this -> clop -> getCurrentValueAsCharString ( curr_entry -> token -> token ) == ERR_SUCCESS ) if ( this -> clop -> token_current_value_as_string ) { tmp_joiner = BP_JoinStrings ( " " , this -> clop -> token_current_value_as_string ) ; BP_COLOR_CODE_SET_T tmp_current_value_colors ; tmp_current_value_colors . fg = BP_COLOR_CODE_FG_GREEN ; tmp_current_value_colors . bg = BP_COLOR_CODE_BG_NONE ; sfsc -> addStringEntry ( tmp_joiner , tmp_joiner , bpstrlen ( tmp_joiner ) , bpstrlen ( tmp_joiner ) , & tmp_current_value_colors , BP_FALSE , 1 , 0 , & BP_STSBS_border_set_onlypadding_no_bottom_border_4 ) ; bpfree ( tmp_joiner ) ; } } if ( curr_entry -> dependencies ) { sfsc -> addColumn ( ) ; char * deps_str = " " ; sfsc -> addStringEntry ( " " , deps_str , bpstrlen ( deps_str ) , bpstrlen ( deps_str ) , NULL , BP_FALSE , 0 , 0 , & BP_STSBS_border_set_onlypadding_no_bottom_border_1 ) ; BP_COLOR_CODE_SET_T tmp_colors ; tmp_colors . fg = BP_COLOR_CODE_FG_NONE ; tmp_colors . bg = BP_COLOR_CODE_BG_NONE ; P_BP_LINKL tmp_tq = BP_CreateLinkL ( " " , BP_FALSE ) ; size_t l = 0 ; for ( l = 0 ; l < curr_entry -> dependency_n ; l ++ ) { tmp_colors . fg = BP_COLOR_CODE_FG_NONE ; tmp_colors . bg = BP_COLOR_CODE_BG_NONE ; if ( curr_entry -> dependencies [ l ] . depends_how != BP_AHG_ENTRY_DEPENDENCY_MANDATORY ) continue ; if ( curr_entry -> dependencies [ l ] . entry -> token -> value_has_been_set_ok == BP_TRUE ) tmp_colors . fg = BP_COLOR_CODE_FG_GREEN ; else tmp_colors . fg = BP_COLOR_CODE_FG_RED ; sfsc -> addStringEntry ( " " , curr_entry -> dependencies [ l ] . entry -> token -> token , bpstrlen ( curr_entry -> dependencies [ l ] . entry -> token -> token ) , bpstrlen ( curr_entry -> dependencies [ l ] . entry -> token -> token ) , & tmp_colors , BP_FALSE , 0 , 0 , & BP_STSBS_border_set_onlypadding_1 ) ; } } } } return ERR_SUCCESS ; }
Builds the application group entry options (cascades)
Builds the application group entry options ( cascades )
// ensure we have a sfsc to work with // ensure that we have groups and a group count // current group and entry // walk groups and generate options // set the current group // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Add Padding Here %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // use empty (random uuid) values // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Add Row Group Data %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // use empty (random uuid) values // now add entries // if the token is required, we set colors on it // fill in the default value if there is on // add a column // sfsc->addColumn(); // create a temporary joiner // set default color to yellow // add it as a value // destroy the joiner here (it's not tailqueue allocated. // add a column // sfsc->addColumn(); // create a temporary joiner // set default color to yellow // add it as a value // destroy the joiner here (it's not tailqueue allocated. // Generate Mandatory Dependency // dependency check //sfsc->addColumn(); // sfsc->DisplayErrors(); // sfsc->displaySFSSession(); // return indicating success