JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
Loading...
Searching...
No Matches
jkqtmathtextnodetools.h
1/*
2 Copyright (c) 2008-2024 Jan W. Krieger (<jan@jkrieger.de>)
3 with contributions from: Razi Alavizadeh
4
5
6
7 This software is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License (LGPL) as published by
9 the Free Software Foundation, either version 2.1 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License (LGPL) for more details.
16
17 You should have received a copy of the GNU Lesser General Public License (LGPL)
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21
22
23
24#ifndef JKQTMATHTEXTNODETOOLS_H
25#define JKQTMATHTEXTNODETOOLS_H
26#include "jkqtmathtext/jkqtmathtext_imexport.h"
27
28class JKQTMathTextNode; // forward
29
30
31/** \brief simplifies the node \a node and the tree below it. You can put the return value in place of \a node after the call
32 * \ingroup jkqtmathtext_items
33 *
34 * Basically this takes does the following steps (recursively):
35 * - remove any JKQTMathTextHorizontalListNode that has only one child
36 * .
37 */
39
40/** \brief calls simplifyJKQTMathTextNode(). In addition it tries to clear whitespace at the start and end of the tree
41 * \ingroup jkqtmathtext_items
42 *
43 * \see simplifyJKQTMathTextNode()
44 */
46
47/*! \brief converts a node-tree with the given \a root into a string, representing the node-tree
48 \ingroup jkqtmathtext_items
49
50 \see This method uses JKQTMathText::getTypeName()
51
52 Here is an example output for
53 \code
54 $x_{1/2}=\frac{-b\pm\sqrt{b^2-4ac}}{2a}$
55 \endcode
56
57 The output looks like this:
58 \verbatim
59JKQTMathTextModifiedTextPropsInstructionNode(equation)
60+--MTHorizontalListNode
61| +--JKQTMathTextTextNode(x)
62| +--MTsubscriptNode
63| | +--MTHorizontalListNode
64| | | +--JKQTMathTextTextNode(1)
65| | | +--JKQTMathTextTextNode(/)
66| | | +--JKQTMathTextTextNode(2)
67| +--JKQTMathTextSymbolNode(=)
68| +--MTfracNode
69| | +--MTHorizontalListNode
70| | | +--JKQTMathTextSymbolNode(-)
71| | | +--JKQTMathTextTextNode(b)
72| | | +--JKQTMathTextSymbolNode(pm)
73| | | +--MTsqrtNode
74| | | | +--MTHorizontalListNode
75| | | | | +--JKQTMathTextTextNode(b)
76| | | | | +--MTsuperscriptNode
77| | | | | | +--JKQTMathTextTextNode(2)
78| | | | | +--JKQTMathTextSymbolNode(-)
79| | | | | +--JKQTMathTextTextNode(4ac)
80| | +--JKQTMathTextTextNode(2a)
81 \endverbatim
82 */
84
85#endif // JKQTMATHTEXTNODETOOLS_H
86
87
88
89
90
91
92
93
94
subclass representing one node in the syntax tree
Definition jkqtmathtextnode.h:37
JKQTMATHTEXT_LIB_EXPORT JKQTMathTextNode * simplifyJKQTMathTextNode(JKQTMathTextNode *node)
simplifies the node node and the tree below it. You can put the return value in place of node after t...
JKQTMATHTEXT_LIB_EXPORT QString JKQTMathTextNodeTree2String(JKQTMathTextNode *root)
converts a node-tree with the given root into a string, representing the node-tree
JKQTMATHTEXT_LIB_EXPORT JKQTMathTextNode * simplifyAndTrimJKQTMathTextNode(JKQTMathTextNode *node)
calls simplifyJKQTMathTextNode(). In addition it tries to clear whitespace at the start and end of th...
#define JKQTMATHTEXT_LIB_EXPORT
Definition jkqtmathtext_imexport.h:108