Fix typo in 9b54bd30006c008b4a951331b273613d5bac3abf
[pm.git] / intl / unicharutil / util / IrishCasing.h
blobf5cb888dc817272196557ef35c2abe6610aee364
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef IrishCasing_h_
7 #define IrishCasing_h_
9 #include <stdint.h>
10 #include "mozilla/Attributes.h"
12 namespace mozilla {
14 class IrishCasing {
15 private:
16 enum IrishStates {
17 kState_Start,
18 kState_InWord,
19 kState_b,
20 kState_bh,
21 kState_d,
22 kState_g,
23 kState_h,
24 kState_m,
25 kState_n,
26 kState_nt_,
27 kState_t,
28 kState_ts,
29 kNumStates
32 enum IrishClasses {
33 kClass_b,
34 kClass_B,
35 kClass_cC,
36 kClass_d,
37 kClass_DG,
38 kClass_fF,
39 kClass_g,
40 kClass_h,
41 kClass_lLNrR,
42 kClass_m,
43 kClass_n,
44 kClass_pP,
45 kClass_sS,
46 kClass_t,
47 kClass_T,
48 kClass_vowel,
49 kClass_Vowel,
50 kClass_hyph,
51 kClass_letter,
52 kClass_other,
53 kNumClasses
56 public:
57 class State {
58 friend class IrishCasing;
60 public:
61 State()
62 : mState(kState_Start)
66 MOZ_IMPLICIT State(const IrishStates& aState)
67 : mState(aState)
71 void Reset()
73 mState = kState_Start;
76 operator IrishStates() const
78 return mState;
81 private:
82 explicit State(uint8_t aState)
83 : mState(IrishStates(aState))
87 uint8_t GetClass(uint32_t aCh);
89 IrishStates mState;
92 enum {
93 kMarkPositionFlag = 0x80,
94 kActionMask = 0x30,
95 kActionShift = 4,
96 kNextStateMask = 0x0f
99 static const uint8_t sUppercaseStateTable[kNumClasses][kNumStates];
100 static const uint8_t sLcClasses[26];
101 static const uint8_t sUcClasses[26];
103 static uint32_t UpperCase(uint32_t aCh, State& aState,
104 bool& aMarkPos, uint8_t& aAction);
106 static bool IsUpperVowel(uint32_t aCh)
108 return GetClass(aCh) == kClass_Vowel;
111 private:
112 static uint8_t GetClass(uint32_t aCh);
115 } // namespace mozilla
117 #endif