library/src/javascript/JSON/BP-JSON.cc
// Attempts to lookup an entry from a table path and entry index (calculated with BP_HASH_ITER_OPEN loop).  If the
// path is set to "/", it will start at the top hive entry of json->json_out.
Attempts to lookup an entry from a table path and entry index (calculated with BP_HASH_ITER_OPEN loop).  If the
path is set to "/", it will start at the top hive entry of json->json_out.
Attempts to lookup an entry from a table path and entry index ( calculated with BP_HASH_ITER_OPEN loop ) . If the path is set to " / " it will start at the top hive entry of json - > json_out .
P_BP_HASH_TABLE_KEYED_ENTRY BP_JSONLookupEntryByTablePathQueryAndEntryIndex(P_BP_JSON json, char *table_lookup_query, size_t entry_index)
{
	if(!json)
		return NULL;
	if(!json->json_out_hreg)
		return NULL;
	if(!json->json_out_hreg->hive)
		return NULL;
	if(!table_lookup_query)
		return NULL;
	if(!BP_StringIsReasonablePrintableString(table_lookup_query, bpstrlen(table_lookup_query), BP_FALSE, BP_FALSE))
		return NULL;
	P_BP_HTKE table_found = (P_BP_HTKE) NULL;
	if(bpstrlen(table_lookup_query) == 1)
	{
		if(table_lookup_query[0] == '/')
		{
			table_found = (P_BP_HTKE) json->json_out_hreg->hive;
		}
	}
	else
	{
		table_found = BP_JSONLookupEntryByPathQuery(json, table_lookup_query);
	}
	if(!table_found)
		return NULL;
	if(table_found->type != BP_HASH_TABLE_KEYED_ENTRY_TYPE_NAMED_HASH_TABLE)
		return NULL;
	size_t iter = 0;
	P_BP_HTKE entry_found = NULL;
	BP_HASH_ITER_OPEN(table_found, tmp_json_entry)
	{
		if(iter == entry_index)
		{
			entry_found = tmp_json_entry;
			break;
		}
		iter++;
	}
	BP_HASH_ITER_CLOSE;
	return entry_found;
}
P_BP_HASH_TABLE_KEYED_ENTRY BP_JSONLookupEntryByTablePathQueryAndEntryIndex ( P_BP_JSON json , char * table_lookup_query , size_t entry_index ) { if ( ! json ) return NULL ; if ( ! json -> json_out_hreg ) return NULL ; if ( ! json -> json_out_hreg -> hive ) return NULL ; if ( ! table_lookup_query ) return NULL ; if ( ! BP_StringIsReasonablePrintableString ( table_lookup_query , bpstrlen ( table_lookup_query ) , BP_FALSE , BP_FALSE ) ) return NULL ; P_BP_HTKE table_found = ( P_BP_HTKE ) NULL ; if ( bpstrlen ( table_lookup_query ) == 1 ) { if ( table_lookup_query [ 0 ] == ' ' ) { table_found = ( P_BP_HTKE ) json -> json_out_hreg -> hive ; } } else { table_found = BP_JSONLookupEntryByPathQuery ( json , table_lookup_query ) ; } if ( ! table_found ) return NULL ; if ( table_found -> type != BP_HASH_TABLE_KEYED_ENTRY_TYPE_NAMED_HASH_TABLE ) return NULL ; size_t iter = 0 ; P_BP_HTKE entry_found = NULL ; BP_HASH_ITER_OPEN ( table_found , tmp_json_entry ) { if ( iter == entry_index ) { entry_found = tmp_json_entry ; break ; } iter ++ ; } BP_HASH_ITER_CLOSE ; return entry_found ; }
Attempts to lookup an entry from a table path and entry index (calculated with BP_HASH_ITER_OPEN loop).
Attempts to lookup an entry from a table path and entry index ( calculated with BP_HASH_ITER_OPEN loop ) .
// set found table to null // if our table lookup query is "/", set lookup position as our top table // if we have a path query, attempt lookup // exit if we cannot lookup the table // ensure // iterating counter // the found entry (if found) // iterate through entries and attempt lookups // if we've found our index, assign the found entry and break the loop // increment the iterator on loop // return the found entry