/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
This file provides a finite state machine to support Irish Gaelic uppercasing rules.
The caller will need to iterate through a string, passing a State variable along with the current character to each UpperCase call and checking the flags that are returned:
If aMarkPos is true, caller must remember the current index in the string as a possible target for a future action.
If aAction is non-zero, then one or more characters from the marked index are to be modified: 1 lowercase the marked letter 2 lowercase the marked letter and its successor 3 lowercase the marked letter, and delete its successor
Actions: 1 lowercase one letter at start of word 2 lowercase two letters at start of word 1d lowercase one letter at start of word, and delete next (and then go to state _, nothing further to do in this word)
else just go to the given state; suffix ' indicates mark start-of-word.
State table array will contain bytes that encode action and new state:
0x80 - bit flag: mark start-of-word position 0x40 - currently unused 0x30 - action mask: 4 values 0x00 - do nothing 0x10 - lowercase one letter 0x20 - lowercase two letters 0x30 - lowercase one, delete one 0x0F - next-state mask
******************************************************************************/
uint8_t IrishCasing::GetClass(uint32_t aCh) { using mozilla::unicode::GetGenCategory; if (aCh >= 'a' && aCh <= 'z') { return sLcClasses[aCh - 'a'];
}
if (aCh >= 'A' && aCh <= 'Z') { return sUcClasses[aCh - 'A'];
}
if (GetGenCategory(aCh) == nsUGenCategory::kLetter) { if (aCh == a_ACUTE || aCh == e_ACUTE || aCh == i_ACUTE || aCh == o_ACUTE ||
aCh == u_ACUTE) { return kClass_vowel;
}
if (aCh == A_ACUTE || aCh == E_ACUTE || aCh == I_ACUTE || aCh == O_ACUTE ||
aCh == U_ACUTE) { return kClass_Vowel;
}
return kClass_letter;
}
if (aCh == '-' || aCh == HYPHEN || aCh == NO_BREAK_HYPHEN) { return kClass_hyph;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.