Пример #1
0
bool PaymentRequestValidator::validateCountryCode(const String& countryCode) const
{
    if (!countryCode) {
        m_window.printErrorMessage("Missing country code.");
        return false;
    }

    for (auto *countryCodePtr = uloc_getISOCountries(); *countryCodePtr; ++countryCodePtr) {
        if (countryCode == *countryCodePtr)
            return true;
    }

    auto message = makeString("\"" + countryCode, "\" is not a valid country code.");
    m_window.printErrorMessage(message);

    return false;
}
Пример #2
0
CFArrayRef CFLocaleCopyISOCountryCodes(void) {
    const char* const* p = uloc_getISOCountries();
    return __CFLocaleCopyCStringsAsArray(p);
}