OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (C) 2013 The Android Open Source Project |
| 3 * |
| 4 * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 * you may not use this file except in compliance with the License. |
| 6 * You may obtain a copy of the License at |
| 7 * |
| 8 * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 * |
| 10 * Unless required by applicable law or agreed to in writing, software |
| 11 * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 * See the License for the specific language governing permissions and |
| 14 * limitations under the License. |
| 15 */ |
| 16 |
| 17 #ifndef DIGRAPH_UTILS_H |
| 18 #define DIGRAPH_UTILS_H |
| 19 |
| 20 #include "third_party/prediction/defines.h" |
| 21 |
| 22 namespace latinime { |
| 23 |
| 24 class DictionaryHeaderStructurePolicy; |
| 25 |
| 26 class DigraphUtils { |
| 27 public: |
| 28 typedef enum { |
| 29 NOT_A_DIGRAPH_INDEX, |
| 30 FIRST_DIGRAPH_CODEPOINT, |
| 31 SECOND_DIGRAPH_CODEPOINT |
| 32 } DigraphCodePointIndex; |
| 33 |
| 34 typedef enum { |
| 35 DIGRAPH_TYPE_NONE, |
| 36 DIGRAPH_TYPE_GERMAN_UMLAUT, |
| 37 } DigraphType; |
| 38 |
| 39 typedef struct { |
| 40 int first; |
| 41 int second; |
| 42 int compositeGlyph; |
| 43 } digraph_t; |
| 44 |
| 45 static bool hasDigraphForCodePoint( |
| 46 const DictionaryHeaderStructurePolicy* const headerPolicy, |
| 47 const int compositeGlyphCodePoint); |
| 48 static int getDigraphCodePointForIndex( |
| 49 const int compositeGlyphCodePoint, |
| 50 const DigraphCodePointIndex digraphCodePointIndex); |
| 51 |
| 52 private: |
| 53 DISALLOW_IMPLICIT_CONSTRUCTORS(DigraphUtils); |
| 54 static DigraphType getDigraphTypeForDictionary( |
| 55 const DictionaryHeaderStructurePolicy* const headerPolicy); |
| 56 static int getAllDigraphsForDigraphTypeAndReturnSize( |
| 57 const DigraphType digraphType, |
| 58 const digraph_t** const digraphs); |
| 59 static const digraph_t* getDigraphForCodePoint( |
| 60 const int compositeGlyphCodePoint); |
| 61 static const digraph_t* getDigraphForDigraphTypeAndCodePoint( |
| 62 const DigraphType digraphType, |
| 63 const int compositeGlyphCodePoint); |
| 64 |
| 65 static const digraph_t GERMAN_UMLAUT_DIGRAPHS[]; |
| 66 static const DigraphType USED_DIGRAPH_TYPES[]; |
| 67 }; |
| 68 } // namespace latinime |
| 69 #endif // DIGRAPH_UTILS_H |
OLD | NEW |