2015-07-01 19:25:47 +00:00
|
|
|
#include "taxonomy.h"
|
|
|
|
#include "gettext.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2015-07-02 17:21:35 +00:00
|
|
|
char *taxonomy_category_names[TC_NR_CATEGORIES] = {
|
2015-07-01 19:25:47 +00:00
|
|
|
QT_TRANSLATE_NOOP("getTextFromC", "None"),
|
|
|
|
QT_TRANSLATE_NOOP("getTextFromC", "Ocean"),
|
|
|
|
QT_TRANSLATE_NOOP("getTextFromC", "Country"),
|
|
|
|
QT_TRANSLATE_NOOP("getTextFromC", "State"),
|
|
|
|
QT_TRANSLATE_NOOP("getTextFromC", "County"),
|
2015-07-10 16:51:50 +00:00
|
|
|
QT_TRANSLATE_NOOP("getTextFromC", "Town"),
|
2015-07-01 19:25:47 +00:00
|
|
|
QT_TRANSLATE_NOOP("getTextFromC", "City")
|
|
|
|
};
|
|
|
|
|
|
|
|
// these are the names for geoname.org
|
2015-07-02 17:21:35 +00:00
|
|
|
char *taxonomy_api_names[TC_NR_CATEGORIES] = {
|
2015-07-01 19:25:47 +00:00
|
|
|
"none",
|
|
|
|
"name",
|
|
|
|
"countryName",
|
|
|
|
"adminName1",
|
|
|
|
"adminName2",
|
2015-07-10 16:51:50 +00:00
|
|
|
"toponymName",
|
|
|
|
"adminName3"
|
2015-07-01 19:25:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct taxonomy *alloc_taxonomy()
|
|
|
|
{
|
2015-07-02 17:21:35 +00:00
|
|
|
return calloc(TC_NR_CATEGORIES, sizeof(struct taxonomy));
|
2015-07-01 19:25:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void free_taxonomy(struct taxonomy *t)
|
|
|
|
{
|
|
|
|
if (t) {
|
2015-07-02 17:21:35 +00:00
|
|
|
for (int i = 0; i < TC_NR_CATEGORIES; i++)
|
2015-07-01 19:25:47 +00:00
|
|
|
free((void *)t[i].value);
|
|
|
|
free(t);
|
|
|
|
}
|
|
|
|
}
|