Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/intl/unicharutil/util/GreekCasing.h
Line
Count
Source (jump to first uncovered line)
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/. */
5
6
#ifndef GreekCasing_h_
7
#define GreekCasing_h_
8
9
#include <stdint.h>
10
#include "mozilla/Attributes.h"
11
12
namespace mozilla {
13
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
    kInWord,
24
    kAlpha,
25
    kEpsilon,
26
    kEta,
27
    kIota,
28
    kOmicron,
29
    kUpsilon,
30
    kOmega,
31
    kAlphaAcc,
32
    kEpsilonAcc,
33
    kEtaAcc,
34
    kEtaAccMarked,
35
    kIotaAcc,
36
    kOmicronAcc,
37
    kUpsilonAcc,
38
    kOmegaAcc,
39
    kOmicronUpsilon,
40
    kDiaeresis
41
  };
42
43
public:
44
  class State {
45
  public:
46
    State()
47
      : mState(kStart)
48
    {
49
    }
50
51
    MOZ_IMPLICIT State(const GreekStates& aState)
52
      : mState(aState)
53
0
    {
54
0
    }
55
56
    void Reset()
57
    {
58
      mState = kStart;
59
    }
60
61
    operator GreekStates() const
62
0
    {
63
0
      return mState;
64
0
    }
65
66
  private:
67
    GreekStates mState;
68
  };
69
70
  static uint32_t UpperCase(uint32_t aCh, State& aState,
71
                            bool& aMarkEtaPos, bool& aUpdateMarkedEta);
72
};
73
74
} // namespace mozilla
75
76
#endif