void resetList(struct keyval *head) { struct keyval *item; while((item = popItem(head))) freeItem(item); }
bool QgsMessageBar::popWidget() { if ( !mCurrentItem ) return false; QgsMessageBarItem *item = mCurrentItem; popItem( item ); delete item; return true; }
bool QgsMessageBar::popWidget() { if ( !mCurrentItem ) return false; resetCountdown(); QgsMessageBarItem *item = mCurrentItem; popItem( item ); return true; }
size_t WKT(int polygon) { while (listHasData(&segs)) { struct keyval *p; unsigned int id, to, from; double x0, y0, x1, y1; p = popItem(&segs); id = strtoul(p->value, NULL, 10); freeItem(p); from = segments[id].from; to = segments[id].to; x0 = nodes[from].lon; y0 = nodes[from].lat; x1 = nodes[to].lon; y1 = nodes[to].lat; add_segment(x0,y0,x1,y1); } return build_geometry(polygon); }
bool QgsMessageBar::popWidget( QgsMessageBarItem *item ) { if ( !item || !mCurrentItem ) return false; if ( item == mCurrentItem ) { popItem( mCurrentItem ); return true; } foreach ( QgsMessageBarItem *existingItem, mItems ) { if ( existingItem == item ) { mItems.removeOne( existingItem ); delete existingItem; return true; } } return false; }
bool QgsMessageBar::popWidget( QgsMessageBarItem *item ) { if ( !item || !mCurrentItem ) return false; if ( item == mCurrentItem ) { popItem( mCurrentItem ); return true; } Q_FOREACH ( QgsMessageBarItem *existingItem, mItems ) { if ( existingItem == item ) { mItems.removeOne( existingItem ); existingItem->deleteLater(); return true; } } return false; }
bool QgsMessageBar::popWidget( QWidget *widget ) { if ( !widget || !mCurrentItem ) return false; if ( widget == mCurrentItem->widget() ) { popItem( mCurrentItem ); return true; } foreach ( QgsMessageBarItem *item, mList ) { if ( item->widget() == widget ) { mList.removeOne( item ); delete item; return true; } } return false; }
void schedulerDispatchTasks( void ) { void (*next_task)(void) = NULL; if(!_scheduler_started) { LOG_ERROR("Scheduler not started."); return; } //TODO: figure out where the critical sections need to go //enterCriticalSection(); //exitCriticalSection(); while( getNumberOfItemsInQueue( &_task_buffer ) > 0 ) { if( popItem( &_task_buffer, (void *)next_task ) == SUCCESS ) { next_task(); } } }
static int split_tags(struct keyval *tags, unsigned int flags, struct keyval *names, struct keyval *places, struct keyval *extratags, int* admin_level, struct keyval ** housenumber, struct keyval ** street, char ** isin, struct keyval ** postcode, struct keyval ** countrycode) { int placehouse = 0; int placebuilding = 0; int placeadmin = 0; struct keyval *landuse; struct keyval *place; struct keyval *item; struct keyval *conscriptionnumber; struct keyval *streetnumber; *admin_level = ADMINLEVEL_NONE; *housenumber = 0; *street = 0; *isin = 0; int isinsize = 0; *postcode = 0; *countrycode = 0; landuse = 0; place = 0; conscriptionnumber = 0; streetnumber = 0; /* Initialise the result lists */ initList(names); initList(places); initList(extratags); /* Loop over the tags */ while ((item = popItem(tags)) != NULL) { /* If this is a name tag, add it to the name list */ if (strcmp(item->key, "ref") == 0 || strcmp(item->key, "int_ref") == 0 || strcmp(item->key, "nat_ref") == 0 || strcmp(item->key, "reg_ref") == 0 || strcmp(item->key, "loc_ref") == 0 || strcmp(item->key, "old_ref") == 0 || strcmp(item->key, "ncn_ref") == 0 || strcmp(item->key, "rcn_ref") == 0 || strcmp(item->key, "lcn_ref") == 0 || strcmp(item->key, "iata") == 0 || strcmp(item->key, "icao") == 0 || strcmp(item->key, "pcode:1") == 0 || strcmp(item->key, "pcode:2") == 0 || strcmp(item->key, "pcode:3") == 0 || strcmp(item->key, "un:pcode:1") == 0 || strcmp(item->key, "un:pcode:2") == 0 || strcmp(item->key, "un:pcode:3") == 0 || strcmp(item->key, "name") == 0 || (strncmp(item->key, "name:", 5) == 0) || strcmp(item->key, "int_name") == 0 || (strncmp(item->key, "int_name:", 9) == 0) || strcmp(item->key, "nat_name") == 0 || (strncmp(item->key, "nat_name:", 9) == 0) || strcmp(item->key, "reg_name") == 0 || (strncmp(item->key, "reg_name:", 9) == 0) || strcmp(item->key, "loc_name") == 0 || (strncmp(item->key, "loc_name:", 9) == 0) || strcmp(item->key, "old_name") == 0 || (strncmp(item->key, "old_name:", 9) == 0) || strcmp(item->key, "alt_name") == 0 || (strncmp(item->key, "alt_name:", 9) == 0) || strcmp(item->key, "official_name") == 0 || (strncmp(item->key, "official_name:", 14) == 0) || strcmp(item->key, "commonname") == 0 || (strncmp(item->key, "commonname:", 11) == 0) || strcmp(item->key, "common_name") == 0 || (strncmp(item->key, "common_name:", 12) == 0) || strcmp(item->key, "place_name") == 0 || (strncmp(item->key, "place_name:", 11) == 0) || strcmp(item->key, "short_name") == 0 || (strncmp(item->key, "short_name:", 11) == 0) || strcmp(item->key, "operator") == 0) /* operator is a bit of an oddity */ { if (strcmp(item->key, "name:prefix") == 0) { pushItem(extratags, item); } else { pushItem(names, item); } } else if (strcmp(item->key, "aerialway") == 0 || strcmp(item->key, "aeroway") == 0 || strcmp(item->key, "amenity") == 0 || strcmp(item->key, "boundary") == 0 || strcmp(item->key, "bridge") == 0 || strcmp(item->key, "craft") == 0 || strcmp(item->key, "emergency") == 0 || strcmp(item->key, "highway") == 0 || strcmp(item->key, "historic") == 0 || strcmp(item->key, "leisure") == 0 || strcmp(item->key, "military") == 0 || strcmp(item->key, "natural") == 0 || strcmp(item->key, "office") == 0 || strcmp(item->key, "railway") == 0 || strcmp(item->key, "shop") == 0 || strcmp(item->key, "tourism") == 0 || strcmp(item->key, "tunnel") == 0 || strcmp(item->key, "waterway") == 0 ) { if (strcmp(item->value, "no")) { pushItem(places, item); if (strcmp(item->key, "boundary") == 0 && strcmp(item->value, "administrative") == 0) { placeadmin = 1; } } else { freeItem(item); } } else if (strcmp(item->key, "place") == 0) { place = item; } else if (strcmp(item->key, "addr:housename") == 0) { pushItem(names, item); placehouse = 1; } else if (strcmp(item->key, "landuse") == 0) { if (strcmp(item->value, "cemetery") == 0) pushItem(places, item); else landuse = item; } else if (strcmp(item->key, "postal_code") == 0 || strcmp(item->key, "post_code") == 0 || strcmp(item->key, "postcode") == 0 || strcmp(item->key, "addr:postcode") == 0 || strcmp(item->key, "tiger:zip_left") == 0 || strcmp(item->key, "tiger:zip_right") == 0) { if (*postcode) freeItem(item); else *postcode = item; } else if (strcmp(item->key, "addr:street") == 0) { *street = item; } else if ((strcmp(item->key, "country_code_iso3166_1_alpha_2") == 0 || strcmp(item->key, "country_code_iso3166_1") == 0 || strcmp(item->key, "country_code_iso3166") == 0 || strcmp(item->key, "country_code") == 0 || strcmp(item->key, "iso3166-1:alpha2") == 0 || strcmp(item->key, "iso3166-1") == 0 || strcmp(item->key, "ISO3166-1") == 0 || strcmp(item->key, "iso3166") == 0 || strcmp(item->key, "is_in:country_code") == 0 || strcmp(item->key, "addr:country") == 0 || strcmp(item->key, "addr:country_code") == 0) && strlen(item->value) == 2) { *countrycode = item; } else if (strcmp(item->key, "addr:housenumber") == 0) { /* house number can be far more complex than just a single house number - leave for postgresql to deal with */ if (*housenumber) freeItem(item); else { *housenumber = item; placehouse = 1; } } else if (strcmp(item->key, "addr:conscriptionnumber") == 0) { if (conscriptionnumber) freeItem(item); else { conscriptionnumber = item; placehouse = 1; } } else if (strcmp(item->key, "addr:streetnumber") == 0) { if (streetnumber) freeItem(item); else { streetnumber = item; placehouse = 1; } } else if (strcmp(item->key, "addr:interpolation") == 0) { /* house number can be far more complex than just a single house number - leave for postgresql to deal with */ if (*housenumber) { freeItem(item); } else { *housenumber = item; addItem(places, "place", "houses", 1); } } else if (strcmp(item->key, "is_in") == 0 || (strncmp(item->key, "is_in:", 5) == 0) || strcmp(item->key, "addr:country")== 0 || strcmp(item->key, "addr:county")== 0 || strcmp(item->key, "tiger:county")== 0 || strcmp(item->key, "addr:city") == 0 || strcmp(item->key, "addr:state_code") == 0 || strcmp(item->key, "addr:state") == 0) { *isin = realloc(*isin, isinsize + 2 + strlen(item->value)); *(*isin+isinsize) = ','; strcpy(*isin+1+isinsize, item->value); isinsize += 1 + strlen(item->value); freeItem(item); } else if (strcmp(item->key, "admin_level") == 0) { *admin_level = atoi(item->value); freeItem(item); } else if (strcmp(item->key, "tracktype") == 0 || strcmp(item->key, "traffic_calming") == 0 || strcmp(item->key, "service") == 0 || strcmp(item->key, "cuisine") == 0 || strcmp(item->key, "capital") == 0 || strcmp(item->key, "dispensing") == 0 || strcmp(item->key, "religion") == 0 || strcmp(item->key, "denomination") == 0 || strcmp(item->key, "sport") == 0 || strcmp(item->key, "internet_access") == 0 || strcmp(item->key, "lanes") == 0 || strcmp(item->key, "surface") == 0 || strcmp(item->key, "smoothness") == 0 || strcmp(item->key, "width") == 0 || strcmp(item->key, "est_width") == 0 || strcmp(item->key, "incline") == 0 || strcmp(item->key, "opening_hours") == 0 || strcmp(item->key, "food_hours") == 0 || strcmp(item->key, "collection_times") == 0 || strcmp(item->key, "service_times") == 0 || strcmp(item->key, "smoking_hours") == 0 || strcmp(item->key, "disused") == 0 || strcmp(item->key, "wheelchair") == 0 || strcmp(item->key, "sac_scale") == 0 || strcmp(item->key, "trail_visibility") == 0 || strcmp(item->key, "mtb:scale") == 0 || strcmp(item->key, "mtb:description") == 0 || strcmp(item->key, "wood") == 0 || strcmp(item->key, "drive_thru") == 0 || strcmp(item->key, "drive_in") == 0 || strcmp(item->key, "access") == 0 || strcmp(item->key, "vehicle") == 0 || strcmp(item->key, "bicyle") == 0 || strcmp(item->key, "foot") == 0 || strcmp(item->key, "goods") == 0 || strcmp(item->key, "hgv") == 0 || strcmp(item->key, "motor_vehicle") == 0 || strcmp(item->key, "motor_car") == 0 || (strncmp(item->key, "access:", 7) == 0) || (strncmp(item->key, "contact:", 8) == 0) || (strncmp(item->key, "drink:", 6) == 0) || strcmp(item->key, "oneway") == 0 || strcmp(item->key, "date_on") == 0 || strcmp(item->key, "date_off") == 0 || strcmp(item->key, "day_on") == 0 || strcmp(item->key, "day_off") == 0 || strcmp(item->key, "hour_on") == 0 || strcmp(item->key, "hour_off") == 0 || strcmp(item->key, "maxweight") == 0 || strcmp(item->key, "maxheight") == 0 || strcmp(item->key, "maxspeed") == 0 || strcmp(item->key, "disused") == 0 || strcmp(item->key, "toll") == 0 || strcmp(item->key, "charge") == 0 || strcmp(item->key, "population") == 0 || strcmp(item->key, "description") == 0 || strcmp(item->key, "image") == 0 || strcmp(item->key, "attribution") == 0 || strcmp(item->key, "fax") == 0 || strcmp(item->key, "email") == 0 || strcmp(item->key, "url") == 0 || strcmp(item->key, "website") == 0 || strcmp(item->key, "phone") == 0 || strcmp(item->key, "tel") == 0 || strcmp(item->key, "real_ale") == 0 || strcmp(item->key, "smoking") == 0 || strcmp(item->key, "food") == 0 || strcmp(item->key, "camera") == 0 || strcmp(item->key, "brewery") == 0 || strcmp(item->key, "locality") == 0 || strcmp(item->key, "wikipedia") == 0 || (strncmp(item->key, "wikipedia:", 10) == 0) ) { pushItem(extratags, item); } else if (strcmp(item->key, "building") == 0) { placebuilding = 1; freeItem(item); } else if (strcmp(item->key, "mountain_pass") == 0) { pushItem(places, item); } else { freeItem(item); } } /* Handle Czech/Slovak addresses: - if we have just a conscription number or a street number, just use the one we have as a house number - if we have both of them, concatenate them so users may search by any of them */ if (conscriptionnumber || streetnumber) { if (*housenumber) { freeItem(*housenumber); } if (!conscriptionnumber) { addItem(tags, "addr:housenumber", streetnumber->value, 0); freeItem(streetnumber); *housenumber = popItem(tags); } if (!streetnumber) { addItem(tags, "addr:housenumber", conscriptionnumber->value, 10); freeItem(conscriptionnumber); *housenumber = popItem(tags); } if (conscriptionnumber && streetnumber) { char * completenumber = strdup(conscriptionnumber->value); size_t completenumberlength = strlen(completenumber); completenumber = realloc(completenumber, completenumberlength + 2 + strlen(streetnumber->value)); *(completenumber + completenumberlength) = '/'; strcpy(completenumber + completenumberlength + 1, streetnumber->value); freeItem(conscriptionnumber); freeItem(streetnumber); addItem(tags, "addr:housenumber", completenumber, 0); *housenumber = popItem(tags); free(completenumber); } } if (place) { if (placeadmin) { pushItem(extratags, place); } else { pushItem(places, place); } } if (placehouse && !listHasData(places)) { addItem(places, "place", "house", 1); } /* Fallback place types - only used if we didn't create something more specific already */ if (placebuilding && !listHasData(places) && (listHasData(names) || *housenumber || *postcode)) { addItem(places, "building", "yes", 1); } if (landuse) { if (!listHasData(places)) { pushItem(places, landuse); } else { freeItem(item); } } if (*postcode && !listHasData(places)) { addItem(places, "place", "postcode", 1); } /* Try to convert everything to an area */ return 1; }
static unsigned int tagtransform_lua_filter_basic_tags(enum OsmType type, struct keyval *tags, int * polygon, int * roads) { #ifdef HAVE_LUA int idx = 0; int filter; int count = 0; struct keyval *item; const char * key, * value; *polygon = 0; *roads = 0; switch (type) { case OSMTYPE_NODE: { lua_getglobal(L, "filter_tags_node"); break; } case OSMTYPE_WAY: { lua_getglobal(L, "filter_tags_way"); break; } case OSMTYPE_RELATION: { lua_getglobal(L, "filter_basic_tags_rel"); break; } } lua_newtable(L); /* key value table */ idx = 1; while( (item = popItem(tags)) != NULL ) { lua_pushstring(L, item->key); lua_pushstring(L, item->value); lua_rawset(L, -3); freeItem(item); count++; } //printf("C count %i\n", count); lua_pushinteger(L, count); if (lua_pcall(L,2,type == OSMTYPE_WAY ? 4 : 2,0)) { fprintf(stderr, "Failed to execute lua function for basic tag processing: %s\n", lua_tostring(L, -1)); /* lua function failed */ return 1; } if (type == OSMTYPE_WAY) { *roads = lua_tointeger(L, -1); lua_pop(L,1); *polygon = lua_tointeger(L, -1); lua_pop(L,1); } lua_pushnil(L); while (lua_next(L,-2) != 0) { key = lua_tostring(L,-2); value = lua_tostring(L,-1); addItem(tags, key, value, 0); lua_pop(L,1); } filter = lua_tointeger(L, -2); lua_pop(L,2); return filter; #else return 1; #endif }
static unsigned int tagtransform_lua_filter_rel_member_tags(struct keyval *rel_tags, int member_count, struct keyval *member_tags,const char **member_role, int * member_superseeded, int * make_boundary, int * make_polygon, int * roads) { #ifdef HAVE_LUA int i; int idx = 0; int filter; int count = 0; struct keyval *item; const char * key, * value; lua_getglobal(L, "filter_tags_relation_member"); lua_newtable(L); /* relations key value table */ idx = 1; while( (item = popItem(rel_tags)) != NULL ) { lua_pushstring(L, item->key); lua_pushstring(L, item->value); lua_rawset(L, -3); freeItem(item); count++; } lua_newtable(L); /* member tags table */ for (i = 1; i <= member_count; i++) { lua_pushnumber(L, i); lua_newtable(L); /* member key value table */ while( (item = popItem(&(member_tags[i - 1]))) != NULL ) { lua_pushstring(L, item->key); lua_pushstring(L, item->value); lua_rawset(L, -3); freeItem(item); count++; } lua_rawset(L, -3); } lua_newtable(L); /* member roles table */ for (i = 0; i < member_count; i++) { lua_pushnumber(L, i + 1); lua_pushstring(L, member_role[i]); lua_rawset(L, -3); } lua_pushnumber(L, member_count); if (lua_pcall(L,4,6,0)) { fprintf(stderr, "Failed to execute lua function for relation tag processing: %s\n", lua_tostring(L, -1)); /* lua function failed */ return 1; } *roads = lua_tointeger(L, -1); lua_pop(L,1); *make_polygon = lua_tointeger(L, -1); lua_pop(L,1); *make_boundary = lua_tointeger(L,-1); lua_pop(L,1); lua_pushnil(L); for (i = 0; i < member_count; i++) { if (lua_next(L,-2)) { member_superseeded[i] = lua_tointeger(L,-1); lua_pop(L,1); } else { fprintf(stderr, "Failed to read member_superseeded from lua function\n"); } } lua_pop(L,2); lua_pushnil(L); while (lua_next(L,-2) != 0) { key = lua_tostring(L,-2); value = lua_tostring(L,-1); addItem(rel_tags, key, value, 0); lua_pop(L,1); } lua_pop(L,1); filter = lua_tointeger(L, -1); lua_pop(L,1); return filter; #else return 1; #endif }
/* Go through the given tags and determine the union of flags. Also remove * any tags from the list that we don't know about */ static unsigned int tagtransform_c_filter_basic_tags(enum OsmType type, struct keyval *tags, int *polygon, int * roads) { int i, filter = 1; int flags = 0; int add_area_tag = 0; enum OsmType export_type; const char *area; struct keyval *item; struct keyval temp; initList(&temp); if (type == OSMTYPE_RELATION) {export_type = OSMTYPE_WAY;} else {export_type = type;} /* We used to only go far enough to determine if it's a polygon or not, but now we go through and filter stuff we don't need */ while ((item = popItem(tags)) != NULL ) { if (type == OSMTYPE_RELATION && !strcmp("type", item->key)) { pushItem(&temp, item); item = NULL; filter = 0; continue; } /* Allow named islands to appear as polygons */ if (!strcmp("natural", item->key) && !strcmp("coastline", item->value)) { add_area_tag = 1; } /* Discard natural=coastline tags (we render these from a shapefile instead) */ if (!options->keep_coastlines && !strcmp("natural", item->key) && !strcmp("coastline", item->value)) { freeItem(item); item = NULL; continue; } for (i = 0; i < exportListCount[export_type]; i++) { if (wildMatch(exportList[export_type][i].name, item->key)) { if (exportList[export_type][i].flags & FLAG_DELETE) { freeItem(item); item = NULL; break; } filter = 0; flags |= exportList[export_type][i].flags; pushItem(&temp, item); item = NULL; break; } } /** if tag not found in list of exports: */ if (i == exportListCount[export_type]) { if (options->enable_hstore) { /* with hstore, copy all tags... */ pushItem(&temp, item); /* ... but if hstore_match_only is set then don't take this as a reason for keeping the object */ if (!options->hstore_match_only && strcmp("osm_uid", item->key) && strcmp("osm_user", item->key) && strcmp("osm_timestamp", item->key) && strcmp("osm_version", item->key) && strcmp("osm_changeset", item->key)) filter = 0; } else if (options->n_hstore_columns) { /* does this column match any of the hstore column prefixes? */ int j; for (j = 0; j < options->n_hstore_columns; j++) { char *pos = strstr(item->key, options->hstore_columns[j]); if (pos == item->key) { pushItem(&temp, item); /* ... but if hstore_match_only is set then don't take this as a reason for keeping the object */ if (!options->hstore_match_only && strcmp("osm_uid", item->key) && strcmp("osm_user", item->key) && strcmp("osm_timestamp", item->key) && strcmp("osm_version", item->key) && strcmp("osm_changeset", item->key)) filter = 0; break; } } /* if not, skip the tag */ if (j == options->n_hstore_columns) { freeItem(item); } } else { freeItem(item); } item = NULL; } } /* Move from temp list back to original list */ while ((item = popItem(&temp)) != NULL ) pushItem(tags, item); *polygon = flags & FLAG_POLYGON; /* Special case allowing area= to override anything else */ if ((area = getItem(tags, "area"))) { if (!strcmp(area, "yes") || !strcmp(area, "true") || !strcmp(area, "1")) *polygon = 1; else if (!strcmp(area, "no") || !strcmp(area, "false") || !strcmp(area, "0")) *polygon = 0; } else { /* If we need to force this as a polygon, append an area tag */ if (add_area_tag) { addItem(tags, "area", "yes", 0); *polygon = 1; } } if (!filter && (type == OSMTYPE_WAY)) { add_z_order(tags,roads); } return filter; }
static int split_tags(struct keyval *tags, unsigned int flags, struct keyval *names, struct keyval *places, int* admin_level, char ** housenumber, char ** street, char ** isin, char ** postcode, char ** countrycode) { int area = 0; int placehouse = 0; struct keyval *item; *admin_level = ADMINLEVEL_NONE; *housenumber = 0; *street = 0; *isin = 0; int isinsize = 0; *postcode = 0; *countrycode = 0; /* Initialise the result lists */ initList(names); initList(places); /* Loop over the tags */ while ((item = popItem(tags)) != NULL) { // fprintf(stderr, "%s\n", item->key); /* If this is a name tag, add it to the name list */ if (strcmp(item->key, "ref") == 0 || strcmp(item->key, "iata") == 0 || strcmp(item->key, "icao") == 0 || strcmp(item->key, "pcode:1") == 0 || strcmp(item->key, "pcode:2") == 0 || strcmp(item->key, "pcode:3") == 0 || strcmp(item->key, "un:pcode:1") == 0 || strcmp(item->key, "un:pcode:2") == 0 || strcmp(item->key, "un:pcode:3") == 0 || strcmp(item->key, "name") == 0 || (strncmp(item->key, "name:", 5) == 0) || strcmp(item->key, "int_name") == 0 || (strncmp(item->key, "int_name:", 9) == 0) || strcmp(item->key, "nat_name") == 0 || (strncmp(item->key, "nat_name:", 9) == 0) || strcmp(item->key, "reg_name") == 0 || (strncmp(item->key, "reg_name:", 9) == 0) || strcmp(item->key, "loc_name") == 0 || (strncmp(item->key, "loc_name:", 9) == 0) || strcmp(item->key, "old_name") == 0 || (strncmp(item->key, "old_name:", 9) == 0) || strcmp(item->key, "alt_name") == 0 || (strncmp(item->key, "alt_name:", 9) == 0) || strcmp(item->key, "official_name") == 0 || (strncmp(item->key, "official_name:", 14) == 0) || strcmp(item->key, "commonname") == 0 || (strncmp(item->key, "commonname:", 11) == 0) || strcmp(item->key, "common_name") == 0 || (strncmp(item->key, "common_name:", 12) == 0) || strcmp(item->key, "place_name") == 0 || (strncmp(item->key, "place_name:", 11) == 0) || strcmp(item->key, "short_name") == 0 || (strncmp(item->key, "short_name:", 11) == 0)) { pushItem(names, item); } else if (strcmp(item->key, "addr:housename") == 0) { pushItem(names, item); placehouse = 1; } else if (strcmp(item->key, "postal_code") == 0 || strcmp(item->key, "post_code") == 0 || strcmp(item->key, "postcode") == 0 || strcmp(item->key, "addr:postcode") == 0) { *postcode = item->value; addItem(places, "place", "postcode", 1); } else if (strcmp(item->key, "addr:street") == 0) { *street = item->value; } else if ((strcmp(item->key, "country_code_iso3166_1_alpha_2") == 0 || strcmp(item->key, "country_code_iso3166_1") == 0 || strcmp(item->key, "country_code_iso3166") == 0 || strcmp(item->key, "country_code") == 0 || strcmp(item->key, "iso3166-1") == 0 || strcmp(item->key, "ISO3166-1") == 0 || strcmp(item->key, "iso3166") == 0 || strcmp(item->key, "is_in:country_code") == 0 || strcmp(item->key, "addr:country") == 0 || strcmp(item->key, "addr:country_code") == 0) && strlen(item->value) == 2) { *countrycode = item->value; } else if (strcmp(item->key, "addr:housenumber") == 0) { // house number can be far more complex than just a single house number - leave for postgresql to deal with *housenumber = item->value; placehouse = 1; } else if (strcmp(item->key, "addr:interpolation") == 0) { // house number can be far more complex than just a single house number - leave for postgresql to deal with *housenumber = item->value; addItem(places, "place", "houses", 1); } else if (strcmp(item->key, "is_in") == 0 || (strncmp(item->key, "is_in:", 5) == 0) || strcmp(item->key, "addr:country")== 0 || strcmp(item->key, "addr:county")== 0 || strcmp(item->key, "addr:city") == 0|| strcmp(item->key, "addr:state") == 0) { *isin = realloc(*isin, isinsize + 2 + strlen(item->value)); *(*isin+isinsize) = ','; strcpy(*isin+1+isinsize, item->value); isinsize += 1 + strlen(item->value); } else if (strcmp(item->key, "admin_level") == 0) { *admin_level = atoi(item->value); } else { const struct taginfo *t; /* If this is a tag we want then add it to the place list */ for (t = taginfo; t->name != NULL; t++) { if ((t->flags & flags) != 0) { if (strcmp(t->name, item->key) == 0 && (t->value == NULL || strcmp(t->value, item->value) == 0)) { if ((t->flags & TAGINFO_AREA) != 0) area = 1; pushItem(places, item); break; } } } /* Free the tag if we didn't want it */ if (t->name == NULL) freeItem(item); } } if (placehouse) { addItem(places, "place", "house", 1); } return area; }
void phdFilterList::popItem(phdFilter * _item) { popItem(indexOf(_item)); }