Remove packaging direcotry
[platform/upstream/icu.git] / source / layout / LookupTables.h
1 /*
2  *
3  * (C) Copyright IBM Corp. 1998-2016 - All Rights Reserved
4  *
5  */
6
7 #ifndef __LOOKUPTABLES_H
8 #define __LOOKUPTABLES_H
9
10 /**
11  * \file
12  * \internal
13  */
14
15 #include "LETypes.h"
16 #include "LayoutTables.h"
17 #include "LETableReference.h"
18 #include "Lookups.h"
19
20 U_NAMESPACE_BEGIN
21
22 enum LookupTableFormat
23 {
24     ltfSimpleArray      = 0,
25     ltfSegmentSingle    = 2,
26     ltfSegmentArray     = 4,
27     ltfSingleTable      = 6,
28     ltfTrimmedArray     = 8
29 };
30
31 typedef le_int16 LookupValue;
32
33 // Different from struct LookupTable in Lookups.h.
34 struct LookupTableBase
35 {
36     le_int16 format;
37 };
38
39 struct LookupSegment
40 {
41     TTGlyphID   lastGlyph;
42     TTGlyphID   firstGlyph;
43     LookupValue value;
44 };
45
46 struct LookupSingle
47 {
48     TTGlyphID   glyph;
49     LookupValue value;
50 };
51
52 struct BinarySearchLookupTable : LookupTableBase
53 {
54     le_int16 unitSize;
55     le_int16 nUnits;
56     le_int16 searchRange;
57     le_int16 entrySelector;
58     le_int16 rangeShift;
59
60     const LookupSegment *lookupSegment(const LETableReference &base, const LookupSegment *segments, LEGlyphID glyph, LEErrorCode &success) const;
61
62     const LookupSingle *lookupSingle(const LETableReference &base, const LookupSingle *entries, LEGlyphID glyph, LEErrorCode &success) const;
63 };
64
65 struct SimpleArrayLookupTable : LookupTableBase
66 {
67     LookupValue valueArray[ANY_NUMBER];
68 };
69 LE_VAR_ARRAY(SimpleArrayLookupTable, valueArray)
70
71 struct SegmentSingleLookupTable : BinarySearchLookupTable
72 {
73     LookupSegment segments[ANY_NUMBER];
74 };
75 LE_VAR_ARRAY(SegmentSingleLookupTable, segments)
76
77 struct SegmentArrayLookupTable : BinarySearchLookupTable
78 {
79     LookupSegment segments[ANY_NUMBER];
80 };
81 LE_VAR_ARRAY(SegmentArrayLookupTable, segments)
82
83 struct SingleTableLookupTable : BinarySearchLookupTable
84 {
85     LookupSingle entries[ANY_NUMBER];
86 };
87 LE_VAR_ARRAY(SingleTableLookupTable, entries)
88
89 struct TrimmedArrayLookupTable : LookupTableBase
90 {
91     TTGlyphID   firstGlyph;
92     TTGlyphID   glyphCount;
93     LookupValue valueArray[ANY_NUMBER];
94 };
95 LE_VAR_ARRAY(TrimmedArrayLookupTable, valueArray)
96
97 U_NAMESPACE_END
98 #endif