library/src/javascript/JSON/BP-JSON.cc
// Attempts to append a hreg to json at a path, using /path/query/lookup.
Attempts to append a hreg to json at a path, using /path/query/lookup.
Attempts to append a hreg to json at a path using / path / query / lookup .
BP_ERROR_T BP_JSONAppendHRegByTablePathQuery
(
		P_BP_JSON                 json,
		P_BP_HASH_TABLE_REGISTRY  hreg,
		char                     *new_appended_table_name,
		char                     *initial_append_path_query,
		BP_BOOL                   include_data,
		BP_BOOL                   base64_encode_bin_data
)
{
	if(!initial_append_path_query)
		return ERR_FAILURE;
	P_BP_HASH_TABLE_KEYED_ENTRY hreg_entry = BP_JSONLookupEntryByPathQuery(json, initial_append_path_query);
	if(!hreg_entry)
	{
		printf("\n [!!] JSON parent path entry not found.");
		return ERR_FAILURE;
	}
	char **add_path = BP_HashRegEntryToPath(hreg_entry);
	BP_ERROR_T ret_val = BP_JSONAppendHRegByTablePath
	(
			json,
			hreg,
			new_appended_table_name,
			add_path,
			include_data,
			base64_encode_bin_data
	);
	if(add_path)
	{
		BP_DestroyPointerArrayNullTerminated((void **) add_path);
		bpfree(add_path);
	}
	return ret_val;
}
BP_ERROR_T BP_JSONAppendHRegByTablePathQuery ( P_BP_JSON json , P_BP_HASH_TABLE_REGISTRY hreg , char * new_appended_table_name , char * initial_append_path_query , BP_BOOL include_data , BP_BOOL base64_encode_bin_data ) { if ( ! initial_append_path_query ) return ERR_FAILURE ; P_BP_HASH_TABLE_KEYED_ENTRY hreg_entry = BP_JSONLookupEntryByPathQuery ( json , initial_append_path_query ) ; if ( ! hreg_entry ) { printf ( " \n " ) ; return ERR_FAILURE ; } char * * add_path = BP_HashRegEntryToPath ( hreg_entry ) ; BP_ERROR_T ret_val = BP_JSONAppendHRegByTablePath ( json , hreg , new_appended_table_name , add_path , include_data , base64_encode_bin_data ) ; if ( add_path ) { BP_DestroyPointerArrayNullTerminated ( ( void * * ) add_path ) ; bpfree ( add_path ) ; } return ret_val ; }
Attempts to append a hreg to json at a path, using /path/query/lookup.
Attempts to append a hreg to json at a path using / path / query / lookup .
// since this function only proxies off to // attempt to lookup the entry within our json (ensure it doesn't exist) // create path // return the state of the hreg append attempt // ensure we have an add path // return indicating success