_size_t_ getVowelPos (ustring ch) { _size_t_ pos = VowelsWithAccents.find (ch.lowercase ()); if (pos != ustring::npos) pos /= NUMBER_OF_ACCENTS; else if (Vowels.find (ch.lowercase ()) != pos) pos = Vowels.find (ch.lowercase ()); return pos; }
_size_t_ getMarkedCharPos (ustring ch) { _size_t_ mark = LettersWithMarks.find (removeAccentFromChar (ch.lowercase ())); if (mark != ustring::npos) mark %= LettersWithoutMarks.length (); return mark; }
Accents getAccentFromChar (ustring ch) { _size_t_ accent = VowelsWithAccents.find (ch.lowercase ()); if (accent != ustring::npos) accent %= NUMBER_OF_ACCENTS; else accent = NO_ACCENT; return accent; }
ustring removeAccentFromChar (ustring ch) { bool isUp = isUpperCase (ch); ch = ch.lowercase (); _size_t_ posVowel = getVowelPos (ch); if (posVowel != ustring::npos) ch = _(Vowels[posVowel]); if (isUp) ch = ch.uppercase (); return ch; }
ustring addAccentToChar (ustring ch, Accents accent) { bool isUp = isUpperCase (ch); ch = ch.lowercase (); _size_t_ pos = Vowels.find (ch); if (pos != ustring::npos) ch = _(VowelsWithAccents[pos * NUMBER_OF_ACCENTS + accent]); if (isUp) ch = ch.uppercase (); return ch; }
bool operator() (const ustring& str1, const ustring& str2) const { if (str1.length() >= str2.length() && str2.lowercase() == str1.substr(0, str2.length()).lowercase()) return false; else return true; }
bool isWordBreak (ustring ch, guint BackspaceChar) { // A char is a word-break if and only if tt's a non-letter // character and not a Backspace. return !isLetter (ch.lowercase ()) && ch != _(BackspaceChar); }
bool isVowel (ustring ch) { return PlainVowels.find (toPlainLetter (ch.lowercase ())) != ustring::npos; }