// ---------------------------------------------------------------------------- // CPcsKeyMap::GetMappedStringL // ---------------------------------------------------------------------------- HBufC* CPcsKeyMap::GetMappedStringL(const TDesC& aSource) const { PRINT1(_L("Enter CPcsKeyMap::GetMappedStringL input '%S'"), &aSource); QString source((QChar*)aSource.Ptr(), aSource.Length()); QString result; TInt err(KErrNone); QT_TRYCATCH_ERROR(err, result = GetMappedString(source)); User::LeaveIfError(err); HBufC* destination = HBufC::NewL(result.length()); destination->Des().Copy(result.utf16()); PRINT1(_L("End CPcsKeyMap::GetMappedStringL result '%S'"), destination); return destination; }
// ---------------------------------------------------------------------------- // CKoreanKeyMap::GetMappedString // Hangul syllable characters are split into Jamos. // Jamos are mapped to sequence of keypresses. // If aSource has spaces, they are treated as separator characters for the // later tokenizing. // ---------------------------------------------------------------------------- QString CKoreanKeyMap::GetMappedString(QString aSource) const { QString destination; TInt length = aSource.length(); for (int i = 0; i < length; ++i) { QChar ch = aSource[i]; if (IsSyllable(ch)) { QString jamos = ExtractJamos(ch); destination.append(GetMappedString(jamos)); destination.append(KSeparatorChar); // Syllable is one token } else { if (ch == KSpaceChar) { destination.append(KSeparatorChar); } else { QString keySequence = MapJamoToKeySequence(ch); // searches iKeyPressMap destination.append(keySequence); } // TODO: detect the syllable limits within stream of Jamos in this way: // syllable begins by C + V pair, which is never in the middle of a syllable. // Currently assumes aSource only contains grammatically valid Jamo stream } } #if defined(WRITE_PRED_SEARCH_LOGS) const int KLogLength = 60; TBuf<KLogLength> log = destination.left(KLogLength).utf16(); PRINT1(_L("End CPcsKeyMap::GetMappedString result '%S'"), &log); #endif return destination; }