From 07ed6e034d5e18860c86020da782c5aa0480a987 Mon Sep 17 00:00:00 2001 From: Rijn Buve Date: Wed, 2 Nov 2016 13:46:38 +0100 Subject: [PATCH] Improved comments on MapcodeElements --- mapcodelib/mapcoder.h | 11 ++++++++++- utility/compile.sh | 7 +++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 utility/compile.sh diff --git a/mapcodelib/mapcoder.h b/mapcodelib/mapcoder.h index 66ef75c..13b88d4 100644 --- a/mapcodelib/mapcoder.h +++ b/mapcodelib/mapcoder.h @@ -47,8 +47,17 @@ typedef struct { } Mapcodes; +/** + * The MapcodeElement structure is returned by decodeXXX and can be used to inspect or clean up the + * mapcode input. The field territoryISO contains the cleaned up territory code from the input, but + * the code may be abbreviated, or even missing (if it wasn't available in the input). + * + * If you want to get a full territory code, use: + * char isoName[MAX_ISOCODE_LEN + 1]; + * getTerritoryIsoName(isoName, mapcodeElement.territoryCode, 0) + */ typedef struct { - char territoryISO[MAX_ISOCODE_LEN + 1]; // The (trimmed and uppercased) candidate territory ISO3166 code. + char territoryISO[MAX_ISOCODE_LEN + 1]; // The (trimmed and uppercased) territory code, from the input. enum Territory territoryCode; // The territory, as recognized and disambiguated from territoryISO. char properMapcode[MAX_PROPER_MAPCODE_LEN + 1]; // The (romanised) mapcode excl. territory or extension. int indexOfDot; // Position of dot in properMapcode (a value between 2 and 5). diff --git a/utility/compile.sh b/utility/compile.sh new file mode 100755 index 0000000..2920322 --- /dev/null +++ b/utility/compile.sh @@ -0,0 +1,7 @@ +#!/bin/sh +echo "Compiling..." +cd ../mapcodelib +gcc -O3 -c mapcoder.c +cd ../utility +gcc -O3 mapcode.cpp -lm -o mapcode ../mapcodelib/mapcoder.o +