geo_search_reply_get_name()

Retrieve the location name of the result at the current index in the reply.

Synopsis:

#include <geo_search.h>
geo_search_error_t geo_search_reply_get_name(const geo_search_reply_t *reply, const char **name)

Since:

BlackBerry 10.0.0

Arguments:

reply

The search reply.

name

The resultant location name (UTF-8 string).

Library:

libgeo_search (For the qcc command, use the -l geo_search option to link against this library)

Description:

The name can be that of a business or venue, or the full address. It is also valid for name to be empty, if a name is not applicable for the resultant location.

The following example shows how geo_search_reply_get_name(), as well as the other geo_search_reply_* functions, can be used as follows:
  int n;
 
  if (GEO_SEARCH_OK != geo_search_reply_get_length(&reply, &n)) {
    n = 0;
  }
 
  printf("** %d entries in reply\n", n);
 
  int i;
  for (i=0; i < n; i++) {
    if (!geo_search_reply_set_index(&reply, i))
      break;
 
    if (i) {
      printf("\n");
    }
 
    const char *value = NULL;
    if (GEO_SEARCH_OK == geo_search_reply_get_name(&reply, &value)) {
      printf("\tname: %s\n", value);
    }
     
    double lat;
    if (GEO_SEARCH_OK == geo_search_reply_get_lat(&reply, &lat)) {
      printf("\tlat: %.6f\n", lat);
    }
     
    double lon;
    if (GEO_SEARCH_OK == geo_search_reply_get_lon(&reply, &lon)) {
      printf("\tlon: %.6f\n", lon);
    }
     
    if (GEO_SEARCH_OK == 
            geo_search_reply_get_description(&reply, &value)) {
      printf("\tdescription: %s\n", value);
    }
     
    if (GEO_SEARCH_OK == geo_search_reply_get_street(&reply,
                                                     &value)) {
      printf("\tstreet: %s\n", value);
    }
     
    if (GEO_SEARCH_OK == geo_search_reply_get_city(&reply, &value)) {
      printf("\tcity: %s\n", value);
    }
     
    if (GEO_SEARCH_OK == geo_search_reply_get_region(&reply,
                                                     &value)) {
      printf("\tregion: %s\n", value);
    }
     
    if (GEO_SEARCH_OK ==
            geo_search_reply_get_county(&reply, &value)) {
      printf("\tcounty: %s\n", value);
    }
   
    if (GEO_SEARCH_OK == 
            geo_search_reply_get_district(&reply, &value)) {
      printf("\tdistrict: %s\n", value);
    }
     
    if (GEO_SEARCH_OK ==
            geo_search_reply_get_country(&reply, &value)) {
      printf("\tcountry: %s\n", value);
    }
     
    if (GEO_SEARCH_OK == 
            geo_search_reply_get_postal_code(&reply, &value)) {
      printf("\tpostal_code: %s\n", value);
    }
     
    int mcc;
    if (GEO_SEARCH_OK == geo_search_reply_get_mcc(&reply, &mcc)) {
      printf("\tmcc: %d\n", mcc);
    }
     
    if (GEO_SEARCH_OK == 
            geo_search_reply_get_timezone(&reply, &value)) {
      printf("\ttimezone: %s\n", value);
    }
     
    if (GEO_SEARCH_OK == 
        geo_search_reply_get_iso_alpha2_country_code(&reply, 
                                                     &value)) {
      printf("\tiso2_country_code: %s\n", value);
    }
     
    if (GEO_SEARCH_OK == 
            geo_search_reply_get_iso_alpha3_country_code(&reply, 
                                                         &value)) {
      printf("\tiso3_country_code: %s\n", value);
    }
     
    int id;
    if (GEO_SEARCH_OK == geo_search_reply_get_iso_country_id(&reply, 
                                                             &id)) {
      printf("\tiso_country_id: %d\n", id);
    }
  }

Returns:

GEO_SEARCH_OK if successful. On error, returns GEO_SEARCH_ERROR_REPLY.