-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: nationality support #991
Open
otahirs
wants to merge
3
commits into
Quick-Box:master
Choose a base branch
from
otahirs:flags
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+292
−15
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
250 changes: 250 additions & 0 deletions
250
quickevent/app/quickevent/plugins/Oris/src/alphatoioc.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,250 @@ | ||
#ifndef ALPHATOIOC_H | ||
#define ALPHATOIOC_H | ||
|
||
#include <QMap> | ||
#include <QString> | ||
|
||
QMap<QString, QString> isoAlpha2ToIoc = { | ||
{"AF", "AFG"}, | ||
{"AL", "ALB"}, | ||
{"DZ", "ALG"}, | ||
{"AS", "ASA"}, | ||
{"AD", "AND"}, | ||
{"AO", "ANG"}, | ||
{"AI", "AIA"}, | ||
{"AG", "ANT"}, | ||
{"AR", "ARG"}, | ||
{"AM", "ARM"}, | ||
{"AW", "ARU"}, | ||
{"AU", "AUS"}, | ||
{"AT", "AUT"}, | ||
{"AZ", "AZE"}, | ||
{"BS", "BAH"}, | ||
{"BH", "BRN"}, | ||
{"BD", "BAN"}, | ||
{"BB", "BAR"}, | ||
{"BY", "BLR"}, | ||
{"BE", "BEL"}, | ||
{"BZ", "BIZ"}, | ||
{"BJ", "BEN"}, | ||
{"BM", "BER"}, | ||
{"BT", "BHU"}, | ||
{"BO", "BOL"}, | ||
{"BQ", "AHO"}, | ||
{"BA", "BIH"}, | ||
{"BW", "BOT"}, | ||
{"BR", "BRA"}, | ||
{"VG", "IVB"}, | ||
{"BN", "BRU"}, | ||
{"BG", "BUL"}, | ||
{"BF", "BUR"}, | ||
{"BI", "BDI"}, | ||
{"CV", "CPV"}, | ||
{"KH", "CAM"}, | ||
{"CM", "CMR"}, | ||
{"CA", "CAN"}, | ||
{"KY", "CAY"}, | ||
{"CF", "CAF"}, | ||
{"TD", "CHA"}, | ||
{"CL", "CHI"}, | ||
{"CN", "CHN"}, | ||
{"HK", "HKG"}, | ||
{"MO", "MAC"}, | ||
{"CO", "COL"}, | ||
{"KM", "COM"}, | ||
{"CG", "CGO"}, | ||
{"CK", "COK"}, | ||
{"CR", "CRC"}, | ||
{"HR", "CRO"}, | ||
{"CU", "CUB"}, | ||
{"CY", "CYP"}, | ||
{"CZ", "CZE"}, | ||
{"KP", "PRK"}, | ||
{"CD", "COD"}, | ||
{"DK", "DEN"}, | ||
{"DJ", "DJI"}, | ||
{"DM", "DMA"}, | ||
{"DO", "DOM"}, | ||
{"EC", "ECU"}, | ||
{"EG", "EGY"}, | ||
{"SV", "ESA"}, | ||
{"GQ", "GEQ"}, | ||
{"ER", "ERI"}, | ||
{"EE", "EST"}, | ||
{"SZ", "SWZ"}, | ||
{"ET", "ETH"}, | ||
{"FK", "FLK"}, | ||
{"FO", "FAR"}, | ||
{"FJ", "FIJ"}, | ||
{"FI", "FIN"}, | ||
{"FR", "FRA"}, | ||
{"GF", "FGU"}, | ||
{"PF", "FPO"}, | ||
{"GA", "GAB"}, | ||
{"GM", "GAM"}, | ||
{"GE", "GEO"}, | ||
{"DE", "GER"}, | ||
{"GH", "GHA"}, | ||
{"GI", "GIB"}, | ||
{"GR", "GRE"}, | ||
{"GL", "GRL"}, | ||
{"GD", "GRN"}, | ||
{"GP", "GUD"}, | ||
{"GU", "GUM"}, | ||
{"GT", "GUA"}, | ||
{"GN", "GUI"}, | ||
{"GW", "GBS"}, | ||
{"GY", "GUY"}, | ||
{"HT", "HAI"}, | ||
{"HN", "HON"}, | ||
{"HU", "HUN"}, | ||
{"IS", "ISL"}, | ||
{"IN", "IND"}, | ||
{"ID", "INA"}, | ||
{"IR", "IRI"}, | ||
{"IQ", "IRQ"}, | ||
{"IE", "IRL"}, | ||
{"IL", "ISR"}, | ||
{"IT", "ITA"}, | ||
{"CI", "CIV"}, | ||
{"JM", "JAM"}, | ||
{"JP", "JPN"}, | ||
{"JO", "JOR"}, | ||
{"KZ", "KAZ"}, | ||
{"KE", "KEN"}, | ||
{"KI", "KIR"}, | ||
{"KW", "KUW"}, | ||
{"KG", "KGZ"}, | ||
{"LA", "LAO"}, | ||
{"LV", "LAT"}, | ||
{"LB", "LIB"}, | ||
{"LS", "LES"}, | ||
{"LR", "LBR"}, | ||
{"LY", "LBA"}, | ||
{"LI", "LIE"}, | ||
{"LT", "LTU"}, | ||
{"LU", "LUX"}, | ||
{"MG", "MAD"}, | ||
{"MW", "MAW"}, | ||
{"MY", "MAS"}, | ||
{"MV", "MDV"}, | ||
{"ML", "MLI"}, | ||
{"MT", "MLT"}, | ||
{"MH", "MSH"}, | ||
{"MQ", "MRT"}, | ||
{"MR", "MTN"}, | ||
{"MU", "MRI"}, | ||
{"YT", "MAY"}, | ||
{"MX", "MEX"}, | ||
{"FM", "FSM"}, | ||
{"MC", "MON"}, | ||
{"MN", "MGL"}, | ||
{"ME", "MGO"}, | ||
{"MS", "MNT"}, | ||
{"MA", "MAR"}, | ||
{"MZ", "MOZ"}, | ||
{"MM", "MYA"}, | ||
{"NA", "NAM"}, | ||
{"NR", "NRU"}, | ||
{"NP", "NEP"}, | ||
{"NL", "NED"}, | ||
{"NC", "NCD"}, | ||
{"NZ", "NZL"}, | ||
{"NI", "NCA"}, | ||
{"NE", "NIG"}, | ||
{"NG", "NGR"}, | ||
{"NU", "NIU"}, | ||
{"NF", "NFI"}, | ||
{"MP", "NMA"}, | ||
{"MK", "MKD"}, | ||
{"NO", "NOR"}, | ||
{"OM", "OMA"}, | ||
{"PK", "PAK"}, | ||
{"PW", "PLW"}, | ||
{"PA", "PAN"}, | ||
{"PG", "PNG"}, | ||
{"PY", "PAR"}, | ||
{"PE", "PER"}, | ||
{"PH", "PHI"}, | ||
{"PL", "POL"}, | ||
{"PT", "POR"}, | ||
{"PR", "PUR"}, | ||
{"QA", "QAT"}, | ||
{"KR", "KOR"}, | ||
{"MD", "MDA"}, | ||
{"RE", "REU"}, | ||
{"RO", "ROU"}, | ||
{"RU", "RUS"}, | ||
{"RW", "RWA"}, | ||
{"SH", "HEL"}, | ||
{"KN", "SKN"}, | ||
{"LC", "LCA"}, | ||
{"PM", "SPM"}, | ||
{"VC", "VIN"}, | ||
{"WS", "SAM"}, | ||
{"SM", "SMR"}, | ||
{"ST", "STP"}, | ||
{"SA", "KSA"}, | ||
{"SN", "SEN"}, | ||
{"RS", "SRB"}, | ||
{"SC", "SEY"}, | ||
{"SL", "SLE"}, | ||
{"SG", "SIN"}, | ||
{"SK", "SVK"}, | ||
{"SI", "SLO"}, | ||
{"SB", "SOL"}, | ||
{"SO", "SOM"}, | ||
{"ZA", "RSA"}, | ||
{"ES", "ESP"}, | ||
{"LK", "SRI"}, | ||
{"PS", "PLE"}, | ||
{"SD", "SUD"}, | ||
{"SR", "SUR"}, | ||
{"SE", "SWE"}, | ||
{"CH", "SUI"}, | ||
{"SY", "SYR"}, | ||
{"TW", "TPE"}, | ||
{"TJ", "TJK"}, | ||
{"TH", "THA"}, | ||
{"TL", "TLS"}, | ||
{"TG", "TOG"}, | ||
{"TO", "TGA"}, | ||
{"TT", "TTO"}, | ||
{"TN", "TUN"}, | ||
{"TR", "TUR"}, | ||
{"TM", "TKM"}, | ||
{"TC", "TKS"}, | ||
{"TV", "TUV"}, | ||
{"UG", "UGA"}, | ||
{"UA", "UKR"}, | ||
{"AE", "UAE"}, | ||
{"GB", "GBR"}, | ||
{"TZ", "TAN"}, | ||
{"US", "USA"}, | ||
{"VI", "ISV"}, | ||
{"UY", "URU"}, | ||
{"UZ", "UZB"}, | ||
{"VU", "VAN"}, | ||
{"VE", "VEN"}, | ||
{"VN", "VIE"}, | ||
{"WF", "WAF"}, | ||
{"YE", "YEM"}, | ||
{"ZM", "ZAM"}, | ||
{"ZW", "ZIM"} | ||
}; | ||
|
||
QString convertToIOC(const QString& alpha2Code) | ||
{ | ||
// Convert to uppercase to ensure consistent lookup | ||
QString normalizedCode = alpha2Code.toUpper(); | ||
|
||
// Check if the code exists in the map | ||
if (isoAlpha2ToIoc.contains(normalizedCode)) { | ||
return isoAlpha2ToIoc.value(normalizedCode); | ||
} | ||
|
||
// Return empty optional if no mapping exists | ||
return QString(); | ||
} | ||
|
||
#endif // ALPHATOIOC_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, fixed list of codes in the source. How will we deal with it if there is any correction or modification of the codes?
Country names evolve over time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose we dont use any packaging system in this c++ project that would handle this. Git submodule for such a small thing would be overkill. The countries participating in orienteering are hardly going to change to have a meaningful impact, but I am open to suggesting how to handle this better.