1// SPDX-License-Identifier: MIT OR MPL-2.0 OR LGPL-2.1-or-later OR GPL-2.0-or-later
2// Copyright 2010, SIL International, All rights reserved.
3
4#pragma once
5#include "inc/Main.h"
6
7
8namespace graphite2 {
9
10class CharInfo
11{
12
13public:
14 CharInfo() : m_char(0), m_before(-1), m_after(-1), m_base(0), m_featureid(0), m_break(0), m_flags(0) {}
15 void init(int cid) { m_char = cid; }
16 unsigned int unicodeChar() const { return m_char; }
17 void feats(int offset) { m_featureid = offset; }
18 int fid() const { return m_featureid; }
19 int breakWeight() const { return m_break; }
20 void breakWeight(int val) { m_break = val; }
21 int after() const { return m_after; }
22 void after(int val) { m_after = val; }
23 int before() const { return m_before; }
24 void before(int val) { m_before = val; }
25 size_t base() const { return m_base; }
26 void base(size_t offset) { m_base = offset; }
27 void addflags(uint8 val) { m_flags |= val; }
28 uint8 flags() const { return m_flags; }
29
30 CLASS_NEW_DELETE
31private:
32 int m_char; // Unicode character from character stream
33 int m_before; // slot index before us, comes before
34 int m_after; // slot index after us, comes after
35 size_t m_base; // offset into input string corresponding to this charinfo
36 uint8 m_featureid; // index into features list in the segment
37 int8 m_break; // breakweight coming from lb table
38 uint8 m_flags; // 0,1 segment split.
39};
40
41} // namespace graphite2
42
43struct gr_char_info : public graphite2::CharInfo {};
44