library/src/blockclass/subclasses/BP_ApplicationHelpGenerator.cc
// adds a usage example to the local class
adds a usage example to the local class
adds a usage example to the local class
BP_ERROR_T BP_ApplicationHelpGenerator::addUsageExample(char *name, char * description, char *usage_string)
{
	if(!name || !description || !usage_string)
		return ERR_FAILURE;
	this->usage_examples = (P_BP_AHG_USAGE_EXAMPLE) tq_realloc(this->tq, this->usage_examples, sizeof(BP_AHG_USAGE_EXAMPLE) * (this->usage_example_n+1), BPLN);
	if(!this->usage_examples)
		return ERR_FAILURE;
	memset(&this->usage_examples[this->usage_example_n], 0x00, sizeof(BP_AHG_USAGE_EXAMPLE));
	this->usage_examples[this->usage_example_n].name         = tq_strdup(this->tq, name, BPLN);
	this->usage_examples[this->usage_example_n].description  = tq_strdup(this->tq, description, BPLN);
	this->usage_examples[this->usage_example_n].usage_string = tq_strdup(this->tq, usage_string, BPLN);
	this->usage_example_n++;
	return ERR_SUCCESS;
}
BP_ERROR_T BP_ApplicationHelpGenerator :: addUsageExample ( char * name , char * description , char * usage_string ) { if ( ! name || ! description || ! usage_string ) return ERR_FAILURE ; this -> usage_examples = ( P_BP_AHG_USAGE_EXAMPLE ) tq_realloc ( this -> tq , this -> usage_examples , sizeof ( BP_AHG_USAGE_EXAMPLE ) * ( this -> usage_example_n + 1 ) , BPLN ) ; if ( ! this -> usage_examples ) return ERR_FAILURE ; memset ( & this -> usage_examples [ this -> usage_example_n ] , 0x00 , sizeof ( BP_AHG_USAGE_EXAMPLE ) ) ; this -> usage_examples [ this -> usage_example_n ] . name = tq_strdup ( this -> tq , name , BPLN ) ; this -> usage_examples [ this -> usage_example_n ] . description = tq_strdup ( this -> tq , description , BPLN ) ; this -> usage_examples [ this -> usage_example_n ] . usage_string = tq_strdup ( this -> tq , usage_string , BPLN ) ; this -> usage_example_n ++ ; return ERR_SUCCESS ; }
adds a usage example to the local class
adds a usage example to the local class
// ensure we have parameters // attempt to allocate memory // ensure the memory was allocated ok // zero out memory // set values // increment count // return indicating success