int CountryCode::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 2) qt_static_metacall(this, _c, _id, _a); _id -= 2; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QString*>(_v) = countryCode(); break; } _id -= 1; } else if (_c == QMetaObject::WriteProperty) { _id -= 1; } else if (_c == QMetaObject::ResetProperty) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 1; } #endif // QT_NO_PROPERTIES return _id; }
int countryModelRow(const std::string& code) { for (int i = 0; i < countryModel_->rowCount(); ++i) if (countryCode(i) == code) return i; return -1; }
std::string lggHunSpell_Wrapper::dictName2FullName(std::string dictName) { if (dictName.empty()) { return dictName; } std::string countryCode(""); std::string languageCode(""); //remove extension dictName = dictName.substr(0,dictName.find(".")); //break it up by - or _ S32 breakPoint = dictName.find("-"); if (breakPoint == std::string::npos) { breakPoint = dictName.find("_"); } if (breakPoint == std::string::npos) { //no country code given languageCode = dictName; } else { languageCode = dictName.substr(0,breakPoint); countryCode = dictName.substr(breakPoint+1); } //get long language code for (int i = 0; i<LANGUAGE_CODES_RAW_SIZE; i++) { if (0 == LLStringUtil::compareInsensitive(languageCode, std::string(languageCodesraw[i]))) { languageCode = languageCodesraw[i+1]; break; } } //get long country code if (!countryCode.empty()) { for (int i =0; i<COUNTRY_CODES_RAW_SIZE; i++) { //llinfos << i << llendl; if (0 == LLStringUtil::compareInsensitive(countryCode, std::string(countryCodesraw[i]))) { countryCode = countryCodesraw[i+1]; break; } } countryCode = " (" + countryCode + ")"; } return std::string(languageCode+countryCode); }
QString QPhoneNumberString::shortFBnumber() const { QString shortNumber; bool diff = false; if ( ! this->isTouchToneNumber() ) return *this; // kDebug() << "Vergleiche : Country\t" << countryCode() // << " " << m_LocalCountryCode; if ( countryCode() == m_LocalCountryCode ) { // kDebug() << "CountryCode stimmt überein, muß nicht hinzugefügt werden"; } else { // kDebug() << "CountryCode stimmt nicht überein"; // kDebug() << " Alles muß zur Nummer hinzugefügt werden"; diff = true; shortNumber += countryCode(); } if ( diff ) { shortNumber += areaCode(); } else { if ( areaCode() == m_LocalAreaCode ) { // kDebug() << "AreaCode stimmt überein, muß nicht hinzugefügt werden"; } else { // kDebug() << "AreaCode stimmt nicht überein"; // kDebug() << " Rest muß zur Nummer hinzugefügt werden"; diff = true; shortNumber += "0" + areaCode(); } } if ( diff ) { shortNumber +=number(); } else { if ( number() == m_LocalNumber ) { // kDebug() << "Number stimmt überein, muß nicht hinzugefügt werden"; } else { // kDebug() << "Number stimmt nicht überein"; // kDebug() << " Rest muß zur Nummer hinzugefügt werden"; diff = true; shortNumber += number(); } } shortNumber += phoneExtensionNumber(); return shortNumber; }
std::string lggHunSpell_Wrapper::fullName2DictName(std::string fullName) { std::string countryCode(""); std::string languageCode(""); S32 breakPoint = fullName.find(" ("); if (breakPoint == std::string::npos) { languageCode = fullName; } else { languageCode = fullName.substr(0, breakPoint); countryCode = fullName.substr(breakPoint+2, fullName.length()-3-breakPoint); } //get long language code for (int i = 1; i<LANGUAGE_CODES_RAW_SIZE; i+=2) { //llinfos << i << llendl; if (0 == LLStringUtil::compareInsensitive(languageCode, std::string(languageCodesraw[i]))) { languageCode = std::string(languageCodesraw[i-1]); break; } } //get long country code std::string toReturn = languageCode; if (!countryCode.empty()) { for (int i = 1; i<COUNTRY_CODES_RAW_SIZE; i+=2) { //llinfos << i << " comparing " <<countryCode<<" and "<<std::string(countryCodesraw[i]).c_str()<< llendl; if (0 == LLStringUtil::compareInsensitive(countryCode, std::string(countryCodesraw[i]))) { countryCode = std::string(countryCodesraw[i-1]); break; } } toReturn += "_" + countryCode; } LLStringUtil::toLower(toReturn); return toReturn; }
// TODO: rewrite this with int32_t ucurr_forLocale(const char* locale, UChar* buff, int32_t buffCapacity, UErrorCode* ec)... static jstring ICU_getCurrencyCode(JNIEnv* env, jclass, jstring javaCountryCode) { UErrorCode status = U_ZERO_ERROR; ScopedResourceBundle supplData(ures_openDirect(U_ICUDATA_CURR, "supplementalData", &status)); if (U_FAILURE(status)) { return NULL; } ScopedResourceBundle currencyMap(ures_getByKey(supplData.get(), "CurrencyMap", NULL, &status)); if (U_FAILURE(status)) { return NULL; } ScopedUtfChars countryCode(env, javaCountryCode); ScopedResourceBundle currency(ures_getByKey(currencyMap.get(), countryCode.c_str(), NULL, &status)); if (U_FAILURE(status)) { return NULL; } ScopedResourceBundle currencyElem(ures_getByIndex(currency.get(), 0, NULL, &status)); if (U_FAILURE(status)) { return env->NewStringUTF("XXX"); } // Check if there's a 'to' date. If there is, the currency isn't used anymore. ScopedResourceBundle currencyTo(ures_getByKey(currencyElem.get(), "to", NULL, &status)); if (!U_FAILURE(status)) { return NULL; } // Ignore the failure to find a 'to' date. status = U_ZERO_ERROR; ScopedResourceBundle currencyId(ures_getByKey(currencyElem.get(), "id", NULL, &status)); if (U_FAILURE(status)) { // No id defined for this country return env->NewStringUTF("XXX"); } int32_t charCount; const jchar* chars = ures_getString(currencyId.get(), &charCount, &status); return (charCount == 0) ? env->NewStringUTF("XXX") : env->NewString(chars, charCount); }
//------------------------------------------------------------------------------ // Printing functions //------------------------------------------------------------------------------ void Airport::printRecord(std::ostream& sout) const { char key1[AP_KEY_LEN+1]; key(key1); char id[AP_IDENT_LEN+1]; ident(id); char ccode[AP_CCODE_LEN+1]; countryCode(ccode); sout << key1; sout << ": "; sout << id; sout << "-"; sout << ccode; sout << " "; sout << char(airportType()); sout << " "; std::streamoff old = sout.precision(); sout.precision(12); sout << latitude(); sout << ", "; sout << longitude(); sout.precision(old); sout << ", "; sout << elevation(); sout << ", mv="; sout << magVariance(); }
QString QPhoneNumberString::prettyPrint(const OutputType type) const { QString niceS; if (isTouchToneNumber()) { switch (type) { case International: if (! m_CountryCode.isNull()) { niceS += "+"; niceS += countryCode(); niceS += " "; } if (! m_AreaCode.isNull()) { niceS += areaCode(); niceS += " "; } if ( ! number().isNull() ) { niceS += number(); } if ( ! m_PhoneExtensionNumber.isNull() ) { niceS += "-"; niceS += phoneExtensionNumber(); } break; case Short: kDebug() << "Not Yet Implemented"; niceS = ""; break; default: kDebug() << "Unknown Type :" << type; niceS = ""; break; } } else { if (isSipNumber()) niceS = *this; } return niceS; }
//------------------------------------------------------------------------------ // Printing functions //------------------------------------------------------------------------------ void Navaid::printRecord(std::ostream& sout) const { char icas[32]; icaoCode(icas); char ikey[32]; key(ikey); char id[12]; ident(id); char ccode[4]; countryCode(ccode); char rc[8]; radioClass(rc); sout << icas << ", "; sout << "\""; sout << ikey; sout << "\", "; sout << id; sout << "-"; sout << static_cast<char>(navaidType()); sout << "-"; sout << ccode; sout << "-"; sout << keyCode(); sout << ":"; std::streamoff old = sout.precision(); sout.precision(12); sout << " "; sout << latitude(); sout << ", "; sout << longitude(); sout.precision(old); sout << ", "; sout << elevation(); sout << " "; sout << frequency(); sout << "-"; sout << channel(); sout << " ( "; sout << magVariance(); sout << ", "; sout << slaveVariance(); sout << " )"; sout << " ("; sout << power(); sout << "-"; sout << rc; sout << "-"; sout << range(); sout << ")"; }