1818extern "C" {
1919#endif
2020
21- #define mapcode_cversion "2.2"
21+ #define mapcode_cversion "2.2.1 "
2222
2323#define UWORD unsigned short int // 2-byte unsigned integer.
2424
@@ -52,7 +52,7 @@ typedef struct {
5252 * mapcodes - a pointer to an Mapcodes, allocated by the caller.
5353 * lat - Latitude, in degrees. Range: -90..90.
5454 * lon - Longitude, in degrees. Range: -180..180.
55- * territoryCode - Territory code (obtained from convertTerritoryIsoNameToCode ), used as encoding context.
55+ * territoryCode - Territory code (obtained from getTerritoryCode ), used as encoding context.
5656 * Pass 0 to get Mapcodes for all territories.
5757 * extraDigits - Number of extra "digits" to add to the generated mapcode. The preferred default is 0.
5858 * Other valid values are 1 and 2, which will add extra letters to the mapcodes to
@@ -84,7 +84,7 @@ int encodeLatLonToMapcodes(
8484 * by the next call to this method!
8585 * lat - Latitude, in degrees. Range: -90..90.
8686 * lon - Longitude, in degrees. Range: -180..180.
87- * territoryCode - Territory code (obtained from convertTerritoryIsoNameToCode ), used as encoding context.
87+ * territoryCode - Territory code (obtained from getTerritoryCode ), used as encoding context.
8888 * Pass 0 to get Mapcodes for all territories.
8989 * extraDigits - Number of extra "digits" to add to the generated mapcode. The preferred default is 0.
9090 * Other valid values are 1 and 2, which will add extra letters to the mapcodes to
@@ -113,8 +113,7 @@ int encodeLatLonToMapcodes_Deprecated( // Warning: this method is deprecated
113113 * The caller should allocate at least MAX_MAPCODE_RESULT_LEN characters for the string.
114114 * lat - Latitude, in degrees. Range: -90..90.
115115 * lon - Longitude, in degrees. Range: -180..180.
116- * territoryCode - Territory code (obtained from convertTerritoryIsoNameToCode), used as encoding context.
117- * Pass 0 to get the shortest Mapcode for all territories.
116+ * territoryCode - Territory code (obtained from getTerritoryCode), used as encoding context.
118117 * extraDigits - Number of extra "digits" to add to the generated mapcode. The preferred default is 0.
119118 * Other valid values are 1 and 2, which will add extra letters to the mapcodes to
120119 * make them represent the coordinate more accurately.
@@ -136,7 +135,7 @@ int encodeLatLonToSingleMapcode(
136135 * lat - Decoded latitude, in degrees. Range: -90..90.
137136 * lon - Decoded longitude, in degrees. Range: -180..180.
138137 * mapcode - Mapcode to decode.
139- * territoryCode - Territory code (obtained from convertTerritoryIsoNameToCode ), used as decoding context.
138+ * territoryCode - Territory code (obtained from getTerritoryCode ), used as decoding context.
140139 * Pass 0 if not available.
141140 *
142141 * Returns:
@@ -169,14 +168,14 @@ int compareWithMapcodeFormat(
169168 * Convert a territory name to a territory code.
170169 *
171170 * Arguments:
172- * isoNam - Territory name to convert .
171+ * string - String starting with ISO code of territory (e.g. "USA" or "US-CA") .
173172 * parentTerritoryCode - Parent territory code, or 0 if not available.
174173 *
175174 * Returns:
176175 * Territory code >0 if succeeded, or <0 if failed.
177176 */
178- int convertTerritoryIsoNameToCode (
179- const char * isoName ,
177+ int getTerritoryCode (
178+ const char * string ,
180179 int parentTerritoryCode );
181180
182181/**
@@ -250,7 +249,7 @@ double maxErrorInMeters(int extraDigits);
250249 * Arguments:
251250 * lat - Latitude, in degrees. Range: -90..90.
252251 * lon - Longitude, in degrees. Range: -180..180.
253- * territoryCode - Territory code (obtained from convertTerritoryIsoNameToCode )
252+ * territoryCode - Territory code (obtained from getTerritoryCode )
254253 *
255254 * returns nonzero if coordinate is near more than one territory border
256255 *
@@ -332,11 +331,12 @@ const UWORD *encodeToAlphabet(const char *string, int alphabet);
332331/**
333332 * List of #defines to support legacy systems.
334333 */
334+ #define convertTerritoryIsoNameToCode getTerritoryCode
335335#define coord2mc (results , lat , lon , territoryCode ) encodeLatLonToMapcodes_Deprecated(results, lat, lon,territoryCode, 0)
336336#define coord2mc1 (results , lat , lon , territoryCode ) encodeLatLonToSingleMapcode(results, lat, lon, territoryCode, 0)
337337#define mc2coord decodeMapcodeToLatLon
338338#define lookslikemapcode compareWithMapcodeFormat
339- #define text2tc convertTerritoryIsoNameToCode
339+ #define text2tc getTerritoryCode
340340#define tc2text convertTerritoryCodeToIsoName
341341#define tccontext getCountryOrParentCountry
342342#define tcparent getParentCountryOf
0 commit comments