library/src/blockclass/subclasses/BP_ApplicationHelpGenerator.cc
// Add a dependency to a option entry (within an option group)
Add a dependency to a option entry (within an option group)
Add a dependency to a option entry ( within an option group )
BP_ERROR_T BP_ApplicationHelpGenerator::addOptionDependencyToOptionEntry
(
	char * group_name,
	char * entry_name,
	char * dependency_group_name,
	char * dependency_name,
	BP_AHG_ENTRY_DEPENDENCY_VALUES depends_how
)
{
	if(this->checkIfDependenciesExist(group_name,entry_name, dependency_group_name, dependency_name, depends_how) == ERR_SUCCESS)
		return ERR_FAILURE;
	if(!group_name || !entry_name)
		return ERR_FAILURE;
	if(!this->groups || !this->group_n)
		return ERR_FAILURE;
	P_BP_AHG_OPTION_GROUP group = this->lookupOptionGroupByName(group_name);
	if(!group)
		return ERR_FAILURE;
	P_BP_AHG_OPTION_GROUP dep_group = this->lookupOptionGroupByName(dependency_group_name);
	if(!dep_group)
		return ERR_FAILURE;
	P_BP_AHG_OPTION_ENTRY entry     = this->lookupEntryInOptionGroup(group , entry_name);
	if(!entry)
		return ERR_FAILURE;
	P_BP_AHG_OPTION_ENTRY dep_entry = this->lookupEntryInOptionGroup(dep_group , dependency_name);
	if(!dep_entry)
		return ERR_FAILURE;
	entry->dependencies = (P_BP_AHG_ENTRY_DEPENDENCY) tq_realloc
	(
		this->tq,
		entry->dependencies,
		sizeof(BP_AHG_ENTRY_DEPENDENCY) * (entry->dependency_n + 1),
		BPLN
	);
	if(!entry->dependencies)
		return ERR_FAILURE;
	memset(&entry->dependencies[entry->dependency_n], 0x00, sizeof(BP_AHG_ENTRY_DEPENDENCY));
	entry->dependencies[entry->dependency_n].depends_how = depends_how;
	entry->dependencies[entry->dependency_n].entry       = dep_entry;
	entry->dependencies[entry->dependency_n].group       = dep_group;
	entry->dependency_n++;
	return ERR_SUCCESS;
}
BP_ERROR_T BP_ApplicationHelpGenerator :: addOptionDependencyToOptionEntry ( char * group_name , char * entry_name , char * dependency_group_name , char * dependency_name , BP_AHG_ENTRY_DEPENDENCY_VALUES depends_how ) { if ( this -> checkIfDependenciesExist ( group_name , entry_name , dependency_group_name , dependency_name , depends_how ) == ERR_SUCCESS ) return ERR_FAILURE ; if ( ! group_name || ! entry_name ) return ERR_FAILURE ; if ( ! this -> groups || ! this -> group_n ) return ERR_FAILURE ; P_BP_AHG_OPTION_GROUP group = this -> lookupOptionGroupByName ( group_name ) ; if ( ! group ) return ERR_FAILURE ; P_BP_AHG_OPTION_GROUP dep_group = this -> lookupOptionGroupByName ( dependency_group_name ) ; if ( ! dep_group ) return ERR_FAILURE ; P_BP_AHG_OPTION_ENTRY entry = this -> lookupEntryInOptionGroup ( group , entry_name ) ; if ( ! entry ) return ERR_FAILURE ; P_BP_AHG_OPTION_ENTRY dep_entry = this -> lookupEntryInOptionGroup ( dep_group , dependency_name ) ; if ( ! dep_entry ) return ERR_FAILURE ; entry -> dependencies = ( P_BP_AHG_ENTRY_DEPENDENCY ) tq_realloc ( this -> tq , entry -> dependencies , sizeof ( BP_AHG_ENTRY_DEPENDENCY ) * ( entry -> dependency_n + 1 ) , BPLN ) ; if ( ! entry -> dependencies ) return ERR_FAILURE ; memset ( & entry -> dependencies [ entry -> dependency_n ] , 0x00 , sizeof ( BP_AHG_ENTRY_DEPENDENCY ) ) ; entry -> dependencies [ entry -> dependency_n ] . depends_how = depends_how ; entry -> dependencies [ entry -> dependency_n ] . entry = dep_entry ; entry -> dependencies [ entry -> dependency_n ] . group = dep_group ; entry -> dependency_n ++ ; return ERR_SUCCESS ; }
Add a dependency to a option entry (within an option group)
Add a dependency to a option entry ( within an option group )
// Check if the dependency already exists. // ensure we have parameters // ensure we have groups to search // attempt to look up the group // attempt to look up the group // lookup entry // lookup dep entry // At this point we've gotten all entries and dependency values. // ensure we could reallocate data // zero out entry // set dependency info // increment the dependency count for the entry // return indicating success