library/src/blockclass/subclasses/BP_ApplicationHelpGenerator.cc
// simply checks to see that dependencies exist or not
simply checks to see that dependencies exist or not
simply checks to see that dependencies exist or not
BP_ERROR_T BP_ApplicationHelpGenerator::checkIfDependenciesExist
(
	char * group_name,
	char * entry_name,
	char * dependency_group_name,
	char * dependency_name,
	BP_AHG_ENTRY_DEPENDENCY_VALUES depends_how
)
{
	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;
	if(!entry->dependency_n || !entry->dependencies)
		return ERR_FAILURE;
	P_BP_AHG_OPTION_ENTRY dep_entry = this->lookupEntryInOptionGroup(dep_group , dependency_name);
	if(!dep_entry)
		return ERR_FAILURE;
	P_BP_AHG_ENTRY_DEPENDENCY curr_dep = NULL;
	size_t n = 0;
	for(; n < entry->dependency_n; n++)
	{
		curr_dep = &entry->dependencies[n];
		if(curr_dep->entry == dep_entry)
		{
			if(depends_how != BP_AHG_ENTRY_DEPENDENCY_NONE)
			if(depends_how != curr_dep->depends_how)
				continue;
			return ERR_SUCCESS;
		}
	}
	return ERR_FAILURE;
}
BP_ERROR_T BP_ApplicationHelpGenerator :: checkIfDependenciesExist ( char * group_name , char * entry_name , char * dependency_group_name , char * dependency_name , BP_AHG_ENTRY_DEPENDENCY_VALUES depends_how ) { 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 ; if ( ! entry -> dependency_n || ! entry -> dependencies ) return ERR_FAILURE ; P_BP_AHG_OPTION_ENTRY dep_entry = this -> lookupEntryInOptionGroup ( dep_group , dependency_name ) ; if ( ! dep_entry ) return ERR_FAILURE ; P_BP_AHG_ENTRY_DEPENDENCY curr_dep = NULL ; size_t n = 0 ; for ( ; n < entry -> dependency_n ; n ++ ) { curr_dep = & entry -> dependencies [ n ] ; if ( curr_dep -> entry == dep_entry ) { if ( depends_how != BP_AHG_ENTRY_DEPENDENCY_NONE ) if ( depends_how != curr_dep -> depends_how ) continue ; return ERR_SUCCESS ; } } return ERR_FAILURE ; }
simply checks to see that dependencies exist or not
simply checks to see that dependencies exist or not
// ensure we have parameters // ensure we have groups to search // attempt to look up the group // attempt to look up the group // lookup entry // ensure we have dependencies to search through // lookup dep entry to make sure it also exists // pointer for holding the current dependency // now ensure that the dependency exists in the entry // set the current dependency // The dependency has to be a pointer EXACT match.  If // it matches, return indicating that we have a dependency match. // return indicating success if all check are ok // return indicating failure if we have no match