Remove the absolute order format
The "absolute order" is a compact representation, originally a historical carry-over from VanillaInput (2004). Modern input methods no longer need such a compact form. It is therefore now removed.
This commit is contained in:
parent
502e8f1ea9
commit
a55c0a4b60
|
@ -138,38 +138,6 @@ class BopomofoSyllable {
|
|||
return *this;
|
||||
}
|
||||
|
||||
uint16_t absoluteOrder() const {
|
||||
// turn BPMF syllable into a 4*14*4*22 number
|
||||
return (uint16_t)(syllable_ & ConsonantMask) +
|
||||
(uint16_t)((syllable_ & MiddleVowelMask) >> 5) * 22 +
|
||||
(uint16_t)((syllable_ & VowelMask) >> 7) * 22 * 4 +
|
||||
(uint16_t)((syllable_ & ToneMarkerMask) >> 11) * 22 * 4 * 14;
|
||||
}
|
||||
|
||||
const std::string absoluteOrderString() const {
|
||||
// 5*14*4*22 = 6160, we use a 79*79 encoding to represent that
|
||||
uint16_t order = absoluteOrder();
|
||||
char low = 48 + static_cast<char>(order % 79);
|
||||
char high = 48 + static_cast<char>(order / 79);
|
||||
std::string result(2, ' ');
|
||||
result[0] = low;
|
||||
result[1] = high;
|
||||
return result;
|
||||
}
|
||||
|
||||
static BopomofoSyllable FromAbsoluteOrder(uint16_t order) {
|
||||
return BopomofoSyllable((order % 22) | ((order / 22) % 4) << 5 |
|
||||
((order / (22 * 4)) % 14) << 7 |
|
||||
((order / (22 * 4 * 14)) % 5) << 11);
|
||||
}
|
||||
|
||||
static BopomofoSyllable FromAbsoluteOrderString(const std::string& str) {
|
||||
if (str.length() != 2) return BopomofoSyllable();
|
||||
|
||||
return FromAbsoluteOrder((uint16_t)(str[1] - 48) * 79 +
|
||||
(uint16_t)(str[0] - 48));
|
||||
}
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& stream,
|
||||
const BopomofoSyllable& syllable);
|
||||
|
||||
|
@ -496,10 +464,6 @@ class BopomofoReadingBuffer {
|
|||
syllable_);
|
||||
}
|
||||
|
||||
const std::string absoluteOrderQueryString() const {
|
||||
return syllable_.absoluteOrderString();
|
||||
}
|
||||
|
||||
bool hasToneMarker() const { return syllable_.hasToneMarker(); }
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in New Issue