2017-04-27 20:24:53 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2015-07-01 12:25:47 -07:00
|
|
|
#ifndef TAXONOMY_H
|
|
|
|
#define TAXONOMY_H
|
|
|
|
|
2024-05-04 13:39:04 +02:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2015-07-01 12:25:47 -07:00
|
|
|
|
|
|
|
enum taxonomy_category {
|
2015-07-02 10:21:35 -07:00
|
|
|
TC_NONE,
|
|
|
|
TC_OCEAN,
|
|
|
|
TC_COUNTRY,
|
|
|
|
TC_ADMIN_L1,
|
|
|
|
TC_ADMIN_L2,
|
|
|
|
TC_LOCALNAME,
|
2015-07-10 09:51:50 -07:00
|
|
|
TC_ADMIN_L3,
|
2015-07-02 10:21:35 -07:00
|
|
|
TC_NR_CATEGORIES
|
2015-07-01 12:25:47 -07:00
|
|
|
};
|
|
|
|
|
2017-10-02 22:54:24 -07:00
|
|
|
enum taxonomy_origin {
|
|
|
|
GEOCODED,
|
|
|
|
GEOPARSED,
|
|
|
|
GEOMANUAL,
|
|
|
|
GEOCOPIED
|
|
|
|
};
|
|
|
|
|
2024-05-04 13:39:04 +02:00
|
|
|
extern const char *taxonomy_category_names[TC_NR_CATEGORIES];
|
|
|
|
extern const char *taxonomy_api_names[TC_NR_CATEGORIES];
|
2015-07-01 12:25:47 -07:00
|
|
|
|
|
|
|
struct taxonomy {
|
2024-06-13 22:59:32 +02:00
|
|
|
taxonomy_category category = TC_NONE; /* the category for this tag: ocean, country, admin_l1, admin_l2, localname, etc */
|
|
|
|
std::string value; /* the value returned, parsed, or manually entered for that category */
|
|
|
|
taxonomy_origin origin = GEOCODED;
|
2015-07-01 12:25:47 -07:00
|
|
|
};
|
|
|
|
|
2024-05-04 13:39:04 +02:00
|
|
|
/* the data block contains taxonomy structures - unused ones have a tag value of NONE */
|
|
|
|
using taxonomy_data = std::vector<taxonomy>;
|
2015-07-01 12:25:47 -07:00
|
|
|
|
2024-05-04 13:39:04 +02:00
|
|
|
std::string taxonomy_get_value(const taxonomy_data &t, enum taxonomy_category cat);
|
|
|
|
std::string taxonomy_get_country(const taxonomy_data &t);
|
2024-05-11 18:23:40 +02:00
|
|
|
std::string taxonomy_get_location_tags(const taxonomy_data &taxonomy, bool for_maintab);
|
2024-05-04 13:39:04 +02:00
|
|
|
void taxonomy_set_category(taxonomy_data &t, enum taxonomy_category category, const std::string &value, enum taxonomy_origin origin);
|
|
|
|
void taxonomy_set_country(taxonomy_data &t, const std::string &country, enum taxonomy_origin origin);
|
2015-07-01 12:25:47 -07:00
|
|
|
|
|
|
|
#endif // TAXONOMY_H
|