Fix typo in 9b54bd30006c008b4a951331b273613d5bac3abf
[pm.git] / intl / unicharutil / util / GreekCasing.h
blob3291908b5be3ad8e662d608413e6c9c44251100a
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 GreekCasing_h_
7 #define GreekCasing_h_
9 #include <stdint.h>
10 #include "mozilla/Attributes.h"
12 namespace mozilla {
14 class GreekCasing {
15 // When doing an Uppercase transform in Greek, we need to keep track of the
16 // current state while iterating through the string, to recognize and process
17 // diphthongs correctly. For clarity, we define a state for each vowel and
18 // each vowel with accent, although a few of these do not actually need any
19 // special treatment and could be folded into kStart.
20 private:
21 enum GreekStates {
22 kStart,
23 kAlpha,
24 kEpsilon,
25 kEta,
26 kIota,
27 kOmicron,
28 kUpsilon,
29 kOmega,
30 kAlphaAcc,
31 kEpsilonAcc,
32 kEtaAcc,
33 kIotaAcc,
34 kOmicronAcc,
35 kUpsilonAcc,
36 kOmegaAcc,
37 kOmicronUpsilon,
38 kDiaeresis
41 public:
42 class State {
43 public:
44 State()
45 : mState(kStart)
49 MOZ_IMPLICIT State(const GreekStates& aState)
50 : mState(aState)
54 void Reset()
56 mState = kStart;
59 operator GreekStates() const
61 return mState;
64 private:
65 GreekStates mState;
68 static uint32_t UpperCase(uint32_t aCh, State& aState);
71 } // namespace mozilla
73 #endif