LibreOffice Module starmath (master) 1
nodetype.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
25enum class SmNodeType : int_fast16_t
26{
27 Table, // tree header
28 Brace, // () [] {}
29 Bracebody, // content of () [] {}
30 Oper, // largeop
31 Align, // alignment
32 Attribute, // attributes
33 Font, // fonts
34 UnHor, // unmo
35 BinHor, // binmo
36 BinVer, // over frac
37 BinDiagonal, // slash
38 SubSup, // lsub lsup rsub rsup csub csup
39 Matrix, // binom matrix
40 Place, // <?>
41 Text, // "text"
42 Special, // %glyph
43 GlyphSpecial, // %glyph
44 Math, // operator value
45 Blank, // ~
46 Error, // Syntax error
47 Line, // a line of math until newline
48 Expression, // { content in here }
49 PolyLine, // ^
50 Root, // root node
51 RootSymbol, // 3 of cubic root
52 Rectangle, //just structural
53 VerticalBrace, // vertical {}
54 MathIdent // identities and variables
55};
56
57namespace starmathdatabase
58{
59inline bool isStructuralNode(SmNodeType aNodeTypeName)
60{
61 return aNodeTypeName == SmNodeType::Table || aNodeTypeName == SmNodeType::Line
62 || aNodeTypeName == SmNodeType::UnHor || aNodeTypeName == SmNodeType::BinHor
63 || aNodeTypeName == SmNodeType::BinVer || aNodeTypeName == SmNodeType::BinDiagonal
64 || aNodeTypeName == SmNodeType::SubSup || aNodeTypeName == SmNodeType::Matrix
65 || aNodeTypeName == SmNodeType::Root || aNodeTypeName == SmNodeType::Expression
66 || aNodeTypeName == SmNodeType::Brace || aNodeTypeName == SmNodeType::Bracebody
67 || aNodeTypeName == SmNodeType::Oper || aNodeTypeName == SmNodeType::Align
68 || aNodeTypeName == SmNodeType::Attribute || aNodeTypeName == SmNodeType::Font;
69}
70
71inline bool isBinOperatorNode(SmNodeType aNodeTypeName)
72{
73 return aNodeTypeName == SmNodeType::BinHor || aNodeTypeName == SmNodeType::BinVer
74 || aNodeTypeName == SmNodeType::BinDiagonal || aNodeTypeName == SmNodeType::SubSup;
75}
76
77inline bool isUnOperatorNode(SmNodeType aNodeTypeName)
78{
79 return aNodeTypeName == SmNodeType::UnHor;
80}
81
82inline bool isOperatorNode(SmNodeType aNodeTypeName)
83{
84 return aNodeTypeName == SmNodeType::BinHor || aNodeTypeName == SmNodeType::BinVer
85 || aNodeTypeName == SmNodeType::BinDiagonal || aNodeTypeName == SmNodeType::SubSup
86 || aNodeTypeName == SmNodeType::UnHor || aNodeTypeName == SmNodeType::Oper;
87}
88
89inline bool isStandaloneNode(SmNodeType aNodeTypeName)
90{
91 return aNodeTypeName == SmNodeType::Text || aNodeTypeName == SmNodeType::Special
92 || aNodeTypeName == SmNodeType::GlyphSpecial || aNodeTypeName == SmNodeType::Math
93 || aNodeTypeName == SmNodeType::Blank || aNodeTypeName == SmNodeType::MathIdent;
94}
95}
96
97/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Error
Parses the starmath code and creates the nodes.
Definition: attribute.hxx:191
bool isUnOperatorNode(SmNodeType aNodeTypeName)
Definition: nodetype.hxx:77
bool isStructuralNode(SmNodeType aNodeTypeName)
Definition: nodetype.hxx:59
bool isStandaloneNode(SmNodeType aNodeTypeName)
Definition: nodetype.hxx:89
bool isBinOperatorNode(SmNodeType aNodeTypeName)
Definition: nodetype.hxx:71
bool isOperatorNode(SmNodeType aNodeTypeName)
Definition: nodetype.hxx:82
SmNodeType
This file provides definition for the nodetypes.
Definition: nodetype.hxx:26