1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 * This file provides definition for the nodetypes.
22 * Also provides analysis of the node functions
25 enum class SmNodeType
: int_fast16_t
29 Bracebody
, // content of () [] {}
32 Attribute
, // attributes
38 SubSup
, // lsub lsup rsub rsup csub csup
39 Matrix
, // binom matrix
43 GlyphSpecial
, // %glyph
44 Math
, // operator value
46 Error
, // Syntax error
47 Line
, // a line of math until newline
48 Expression
, // { content in here }
51 RootSymbol
, // 3 of cubic root
52 Rectangle
, //just structural
53 VerticalBrace
, // vertical {}
54 MathIdent
// identities and variables
57 namespace starmathdatabase
59 inline bool isStructuralNode(SmNodeType aNodeTypeName
)
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
;
71 inline bool isBinOperatorNode(SmNodeType aNodeTypeName
)
73 return aNodeTypeName
== SmNodeType::BinHor
|| aNodeTypeName
== SmNodeType::BinVer
74 || aNodeTypeName
== SmNodeType::BinDiagonal
|| aNodeTypeName
== SmNodeType::SubSup
;
77 inline bool isUnOperatorNode(SmNodeType aNodeTypeName
)
79 return aNodeTypeName
== SmNodeType::UnHor
;
82 inline bool isOperatorNode(SmNodeType aNodeTypeName
)
84 return aNodeTypeName
== SmNodeType::BinHor
|| aNodeTypeName
== SmNodeType::BinVer
85 || aNodeTypeName
== SmNodeType::BinDiagonal
|| aNodeTypeName
== SmNodeType::SubSup
86 || aNodeTypeName
== SmNodeType::UnHor
|| aNodeTypeName
== SmNodeType::Oper
;
89 inline bool isStandaloneNode(SmNodeType aNodeTypeName
)
91 return aNodeTypeName
== SmNodeType::Text
|| aNodeTypeName
== SmNodeType::Special
92 || aNodeTypeName
== SmNodeType::GlyphSpecial
|| aNodeTypeName
== SmNodeType::Math
93 || aNodeTypeName
== SmNodeType::Blank
|| aNodeTypeName
== SmNodeType::MathIdent
;
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */