corrected documentation

This commit is contained in:
jkriege2 2019-01-19 16:54:31 +01:00
parent bf30964f0f
commit 306436f770
13 changed files with 215 additions and 212 deletions

1
.gitignore vendored
View File

@ -89,3 +89,4 @@ Thumbs.db
moc_predefs.h
/lib/jkqtplotter/*.TMP
/doc/doxygen_log.txt
/doc/*.tmp

View File

@ -122,7 +122,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
<tr><th> Screenshot <th> Description <th> Notes
<tr><td> \image html jkqtmathtext_simpletest_small.png
<td> \subpage JKQTmathTextSimpleExample
<td> JKQTMathText<br>render LaTeX markup (Schrödinger's equation)
<td> JKQTmathText<br>render LaTeX markup (Schrödinger's equation)
</table>

View File

@ -1,8 +1,8 @@
/*!
\defgroup jkqtmathtext JKQtMathText LaTeX-Renderer for Qt
\defgroup jkqtmathtext JKQTmathText LaTeX-Renderer for Qt
This group contains JKQtMathText, a self-contained LaTeX-renderer for Qt. It is used to renderer
This group contains JKQTmathText, a self-contained LaTeX-renderer for Qt. It is used to renderer
labels in JKQtPlotter, but can be used independently. The class does not depend on any library,
except Qt. In particular it actually parses a LaTeX string and draws it in pure C++. It does NOT rely
on an installed LaTeX for the rendering!

View File

@ -13,7 +13,7 @@ This software is licensed under the term of the GNU Lesser General Public Licens
- high-quality plotting
- no other dependencies than Qt >=4.7 (compatible with Qt 5.xx)
- highly customizable axes/grids (linear/log, date/time, custom ticks ...)
- integrated LaTeX parser/renderer JKQtMathText for axis labels, ticks, notes ...
- integrated LaTeX parser/renderer JKQTmathText for axis labels, ticks, notes ...
- extensive user-interactions pre-programmed (several zooming modes, selecting regions, custom context menus, switch graph visibility, ...)
- full print and export (PDF,PNG,...) support with preview and parametrization out-the-box
- highly customizable look and feel
@ -39,7 +39,7 @@ This software is licensed under the term of the GNU Lesser General Public Licens
- geometric forms/annotations, see: \ref jkqtplotter_geoplots
- can be easily extended by deriving a new graph from JKQTPplotElement or JKQTPplotObject
- optional: OpenCV interface, see: \ref jkqtpopencvinterface
- integrated LaTeX parser/renderer JKQtMathText:
- integrated LaTeX parser/renderer JKQTmathText:
- pure C++
- no dependencies in particular no installed LaTeX required
- can be used independently of JKQtPlotter

View File

@ -54,6 +54,6 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
| Screenshot | Description | Notes |
|:-------------:| ------------- | ------------- |
| [![](../screenshots/jkqtmathtext_simpletest_small.png)](./jkqtmathtext_simpletest) | [JKQTMathText: LaTeX Renderer](./jkqtmathtext_simpletest) | |
| [![](../screenshots/jkqtmathtext_simpletest_small.png)](./jkqtmathtext_simpletest) | [JKQTmathText: LaTeX Renderer](./jkqtmathtext_simpletest) | |

View File

@ -193,7 +193,7 @@
</layout>
</item>
<item row="15" column="0" colspan="2">
<widget class="JKQTMathTextLabel" name="labMath">
<widget class="JKQTmathTextLabel" name="labMath">
<property name="text">
<string>left(left[sqrt{2picdotint_{-infty}^infty f(x);mathrm{d}x}right]right) </string>
</property>
@ -418,7 +418,7 @@
</widget>
<customwidgets>
<customwidget>
<class>JKQTMathTextLabel</class>
<class>JKQTmathTextLabel</class>
<extends>QLabel</extends>
<header>jkqtmathtext/jkqtmathtext.h</header>
</customwidget>

View File

@ -4,9 +4,9 @@ This directory contains all files that belong to the JKQtPlotter library (includ
### simply include all necessary files
If you use QMake and simply want to include all necessary files into your project, include one of these `PRI`-files into your QMake Project:
- `jkqtplotter.pri` contains all files in this library, including `JKQtFastPlotter` and `JKQtMathText`
- `jkqtplotter.pri` contains all files in this library, including `JKQtFastPlotter` and `JKQTmathText`
- `jkqtfastplotter.pri` contains only those files from this directory which are necessary to build `JKQtFastPlotter`
- `jkqtmathtext.pri` contains only those files from this directory which are necessary to build `JKQtMathText`
- `jkqtmathtext.pri` contains only those files from this directory which are necessary to build `JKQTmathText`
### Build static libraries
In the directory [`../staticlib`](../staticlib) you will find several Project files that build a static library of the full JKQtPlotter (including JKQtFastPlotter and JKMathText), or of subsets of this library. You can then link against these libs in your project.

View File

@ -4208,7 +4208,7 @@ QString JKQTmathText::decorationToString(JKQTmathText::MTdecoration mode)
return "unknown";
}
JKQTMathTextLabel::JKQTMathTextLabel(QWidget *parent):
JKQTmathTextLabel::JKQTmathTextLabel(QWidget *parent):
QLabel(parent)
{
m_mathText=new JKQTmathText(this);
@ -4219,16 +4219,16 @@ JKQTMathTextLabel::JKQTMathTextLabel(QWidget *parent):
buffer=QPixmap();
}
JKQTMathTextLabel::~JKQTMathTextLabel()
JKQTmathTextLabel::~JKQTmathTextLabel()
{
}
JKQTmathText *JKQTMathTextLabel::getMathText() const
JKQTmathText *JKQTmathTextLabel::getMathText() const
{
return m_mathText;
}
void JKQTMathTextLabel::setMath(const QString &text, bool doRepaint)
void JKQTmathTextLabel::setMath(const QString &text, bool doRepaint)
{
if (text!=lastText || doRepaint){
lastText=text;
@ -4239,7 +4239,7 @@ void JKQTMathTextLabel::setMath(const QString &text, bool doRepaint)
}
void JKQTMathTextLabel::internalPaint()
void JKQTmathTextLabel::internalPaint()
{
//return;
//qDebug()<<"internalPaint "<<lastText<<repaintDo;
@ -4249,7 +4249,7 @@ void JKQTMathTextLabel::internalPaint()
repaintDo=false;
//qDebug()<<"internalPaint(): parse "<<m_mathText->parse(lastText)<<"\n "<<m_mathText->get_error_list().join("\n")<<"\n\n";
if (!m_mathText->parse(lastText)) {
qDebug()<<"JKQTMathTextLabel::internalPaint(): parse '"<<lastText<<"': "<<m_mathText->parse(lastText)<<"\n "<<m_mathText->get_error_list().join("\n")<<"\n\n";
qDebug()<<"JKQTmathTextLabel::internalPaint(): parse '"<<lastText<<"': "<<m_mathText->parse(lastText)<<"\n "<<m_mathText->get_error_list().join("\n")<<"\n\n";
}
if (buffer.width()<=0 || buffer.height()<=0) buffer=QPixmap(1000,100);
@ -4283,7 +4283,7 @@ void JKQTMathTextLabel::internalPaint()
//qDebug()<<"internalPaint(): DONE";
}
void JKQTMathTextLabel::paintEvent(QPaintEvent *event)
void JKQTmathTextLabel::paintEvent(QPaintEvent *event)
{
//QLabel::paintEvent(event);
//return;
@ -4364,7 +4364,7 @@ QString JKQTmathText::MTplainTextNode::textTransform(const QString &text, JKQTma
return text;
}
void initJKQtMathTextResources()
void initJKQTmathTextResources()
{
Q_INIT_RESOURCE(xits);
}

View File

@ -50,24 +50,24 @@
/** \brief initialized Qt-ressources necessary for JKQtMathText
/** \brief initialized Qt-ressources necessary for JKQTmathText
* \ingroup jkqtmathtext
*/
LIB_EXPORT void initJKQtMathTextResources();
LIB_EXPORT void initJKQTmathTextResources();
/*! \brief this class parses a LaTeX string and can then draw the contained text/equation onto a QPainter
\ingroup jkqtmathtext
JKQtMathText is a self-contained LaTeX-renderer for Qt. It is used to renderer
labels in JKQtPlotter/JKQtBasePlotter, but can be used independently.
The class does not depend on any library, except Qt.
In particular it actually parses a LaTeX string and draws it in pure C++. It does NOT rely
on an installed LaTeX for the rendering!
JKQTmathText is a self-contained LaTeX-renderer for Qt. It is used to renderer
labels in JKQtPlotter/JKQtBasePlotter, but can be used independently.
The class does not depend on any library, except Qt.
In particular it actually parses a LaTeX string and draws it in pure C++. It does NOT rely
on an installed LaTeX for the rendering!
\section JKQtMathTextUsage Usage
\subsection JKQtMathTextUsageDirect Direct Usage
This small piece of C++ code may serve as an example of the usage and capabilities of the class:
\section JKQTmathTextUsage Usage
\subsection JKQTmathTextUsageDirect Direct Usage
This small piece of C++ code may serve as an example of the usage and capabilities of the class:
\code
// create a JKQTmathText object.
JKQTmathText mathText;
@ -87,36 +87,36 @@ LIB_EXPORT void initJKQtMathTextResources();
painter.end();
\endcode
\subsection JKQtMathTextSizing Determining the size of an equation
\subsection JKQTmathTextSizing Determining the size of an equation
In addition there are also functions that allow to calculate the size of the equation, before drawing it (just like the functions in <a href="http://doc.qt.io/qt-5/qfontmetrics.html">QFontMetrics</a> and <a href="http://doc.qt.io/qt-5/qfontmetricsf.html">QFontMetricsF</a>):
- getSizeDetail()
- getSize()
- getAscent(), getDescent()
.
In addition there are also functions that allow to calculate the size of the equation, before drawing it (just like the functions in <a href="http://doc.qt.io/qt-5/qfontmetrics.html">QFontMetrics</a> and <a href="http://doc.qt.io/qt-5/qfontmetricsf.html">QFontMetricsF</a>):
- getSizeDetail()
- getSize()
- getAscent(), getDescent()
.
\subsection JKQtMathTextErrorHandling Error Handling
\subsection JKQTmathTextErrorHandling Error Handling
The class is designed to be as robust as possible and will still return some output, even if the equation contains some errors.
Nevertheless, several errors are detected while parsing. You can get a list of error messages using get_error_list() after calling parse().
Also parse() will return \c false if an error occured while parsing.
The class is designed to be as robust as possible and will still return some output, even if the equation contains some errors.
Nevertheless, several errors are detected while parsing. You can get a list of error messages using get_error_list() after calling parse().
Also parse() will return \c false if an error occured while parsing.
\subsection JKQtMathTextUsageQLabel Usage within a QLabel class JKQTMathTextLabel
\subsection JKQTmathTextUsageQLabel Usage within a QLabel class JKQTmathTextLabel
Finally, there is also a QLabel-derived class JKQTMathTextLabel which can be used for drawing a LaTeX string onto a Qt form.
Finally, there is also a QLabel-derived class JKQTmathTextLabel which can be used for drawing a LaTeX string onto a Qt form.
\see JKQTMathTextLabel
\see JKQTmathTextLabel
\section JKQtMathTextExamples Examples
\section JKQTmathTextExamples Examples
Examples for the usage of this class can be found here:
- \ref JKQTmathTextSimpleExample
.
Examples for the usage of this class can be found here:
- \ref JKQTmathTextSimpleExample
.
\section JKQtMathTextSuppoertedLaTeX Supported LaTeX Subset
\section JKQTmathTextSuppoertedLaTeX Supported LaTeX Subset
The supported LaTeX subset is listes below. Please note that some commands are used differently than in actual LaTeX.
For example \c \\bf is just a renamed form of \c \\textbf and used as \c \\bf{...} and NOT as \c {\\bf...} .
@ -152,7 +152,7 @@ LIB_EXPORT void initJKQtMathTextResources();
- \c \\left~ \c \\right~ : ceil braces |~ ~|
.
\section JKQtMathTextSuppoertedFonts Font Handling
\section JKQTmathTextSuppoertedFonts Font Handling
Several fonts are defined as properties to the class:
- A "roman" font used as the standard font ( set_fontRoman() in math-mode set_fontMathRoman() )
@ -167,24 +167,24 @@ LIB_EXPORT void initJKQtMathTextResources();
- A "caligraphic" font used to display caligraphic characters ( set_fontCaligraphic() )
.
These fonts are generic font classes, which font is actually used can be configured in JKQtMathText class with the \c set_...() functions mentioned above. You can also use these functions to set the fonts used for math rendering in math-mode:
These fonts are generic font classes, which font is actually used can be configured in JKQTmathText class with the \c set_...() functions mentioned above. You can also use these functions to set the fonts used for math rendering in math-mode:
- useSTIX() use the STIX fonts from <a href="https://www.stixfonts.org/">https://www.stixfonts.org/</a> in math-mode<br>\image html jkqtmathparser_stix.png
- useXITS() use the XITS fonts from <a href="https://github.com/alif-type/xits">https://github.com/alif-type/xits</a> in math-mode. These are included by default in this library and also activated by default.<br>\image html jkqtmathparser_xits.png
- useASANA() use the ASANA fonts from <a href="https://ctan.org/tex-archive/fonts/Asana-Math/">https://ctan.org/tex-archive/fonts/Asana-Math/</a> in math-mode<br>\image html jkqtmathparser_asana.png
- useAnyUnicode() use generic Unicode fonts, e.g. "Arial" and "Times New Roman" in math-mode. You should use fonts that contain as many of the mathematical symbols as possible to ensure good rendering results.<br>using "Times New Roman": \image html jkqtmathparser_timesnewroman.png
<br>using "Arial": \image html jkqtmathparser_arial.png
<br>using "Courier New": \image html \image html jkqtmathparser_couriernew.png
<br>using "Comic Sans MS": \image html \image html jkqtmathparser_comicsans.png
<br>using "Courier New": \image html jkqtmathparser_couriernew.png
<br>using "Comic Sans MS": \image html jkqtmathparser_comicsans.png
.
Math-mode is activated by enclosing your equation in \c $...$ or \c \\[...\\] . This mode is optimized for mathematical equations. Here is an example of the difference:
- <b>math-mode (XITS is used)</b> \c $...$: <br>\image html jkqtmathparser_schreq_mathmode.png
- <b>normal mode (Times new Roman is used)</b>: <br>\image html jkqtmathparser_schreq_normalmode.png
.
Math-mode is activated by enclosing your equation in \c $...$ or \c \\[...\\] . This mode is optimized for mathematical equations. Here is an example of the difference:
- <b>math-mode (XITS fonts are used, whitespaces are mostly not drawn directly, symbol spacing is different)</b> \c $...$: <br>\image html jkqtmathparser_schreq_mathmode.png
- <b>normal mode (Times new Roman is used, whitespaces are evaluated directly)</b>: <br>\image html jkqtmathparser_schreq_normalmode.png
.
\section JKQtMathTextToHTML Convert to HTML
\section JKQTmathTextToHTML Convert to HTML
The method toHtml() may be used to get a HTML representation of the LaTeX string, if possible (only for simple LaTeX equations!). Whether
the transformation was possible is returned as a call by value argument!
@ -1467,18 +1467,18 @@ inline uint qHash(const JKQTmathText::tbrDataH& data) {
\see JKQTmathText
*/
class LIB_EXPORT JKQTMathTextLabel: public QLabel {
class LIB_EXPORT JKQTmathTextLabel: public QLabel {
Q_OBJECT
public:
explicit JKQTMathTextLabel(QWidget* parent=nullptr);
virtual ~JKQTMathTextLabel();
explicit JKQTmathTextLabel(QWidget* parent=nullptr);
virtual ~JKQTmathTextLabel();
/** \brief returns the internal JKQTmathText instance used for drawing
*
* Use this function to set the font, font size and other properties of the used renderer.
*/
/** \brief returns the internal JKQTmathText instance used for drawing
*
* Use this function to set the font, font size and other properties of the used renderer.
*/
JKQTmathText* getMathText() const;
/** \brief set the equation to draw */
/** \brief set the equation to draw */
void setMath(const QString& text, bool doRepaint=true);
protected:
JKQTmathText* m_mathText;

View File

@ -67,7 +67,7 @@ static QList<JKQtBasePlotter::JKQTPSaveDataAdapter*> jkqtpSaveDataAdapters;
void initJKQtBasePlotterResources()
{
Q_INIT_RESOURCE(jkqtpbaseplotter);
initJKQtMathTextResources();
initJKQTmathTextResources();
}
JKQtBasePlotter::JKQtBasePlotter()

View File

@ -379,7 +379,7 @@ class LIB_EXPORT JKQTPgeoSymbol: public JKQTPplotObject {
};
/*! \brief This JKQTPplotObject is used to display text. It uses the JKQTMathText
/*! \brief This JKQTPplotObject is used to display text. It uses the JKQTmathText
class in order to display LaTeX formulas.
\ingroup jkqtplotter_geoplots

View File

@ -38,7 +38,7 @@
* \ingroup jkmp
*/
/**
/**
* \defgroup jkmpErrorhandling error handling
* \ingroup jkmp
*/
@ -70,6 +70,8 @@
/*! \brief A simple function parser to parse (build memory tree representation) and
evaluate simple mathematical expressions
\ingroup jkmp
This class implements a simple function parser which can parse
mathematical expressions like <code> z=a*3+2.34^2*sin(pi*sqrt(x))</code> .
More than one expression can be separated by semicolon ';'. The result of
@ -184,62 +186,62 @@
\section jkmp_example Simple Example of Usage
\code
try {
jkMathParser mp; // instanciate
jkmpNode* n;
jkmpResult r;
// parse some numeric expression
n=mp.parse("pi^2+4*sin(65*pi/exp(3.45))");
r=n->evaluate();
cout<<r.num<<endl;
//delete n;
\section jkmp_example Simple Example of Usage
\code
try {
jkMathParser mp; // instanciate
jkmpNode* n;
jkmpResult r;
// parse some numeric expression
n=mp.parse("pi^2+4*sin(65*pi/exp(3.45))");
r=n->evaluate();
cout<<r.num<<endl;
//delete n;
// parse some boolean expression
n=mp.parse("true==false");
r=n->evaluate();
if (r.type==jkmpBool) {
if (r.boolean) cout<<"true";
else cout<<"false";
}
if (r.type==jkmpDouble) cout<<r.num<<endl;
if (r.type==jkmpString) cout<<r.str<<endl;
delete n;
// parse some boolean expression
n=mp.parse("true==false");
r=n->evaluate();
if (r.type==jkmpBool) {
if (r.boolean) cout<<"true";
else cout<<"false";
}
if (r.type==jkmpDouble) cout<<r.num<<endl;
if (r.type==jkmpString) cout<<r.str<<endl;
delete n;
// parse some string expression
n=mp.parse("var1='false'; var1+'true'");
r=n->evaluate();
if (r.type==jkmpString) cout<<r.str<<endl;
delete n;
} catch(std::exception& E) {
cout<<"ERROR!!!\n "<<E.what()<<endl<<endl;
}
\endcode
// parse some string expression
n=mp.parse("var1='false'; var1+'true'");
r=n->evaluate();
if (r.type==jkmpString) cout<<r.str<<endl;
delete n;
} catch(std::exception& E) {
cout<<"ERROR!!!\n "<<E.what()<<endl<<endl;
}
\endcode
\section jkmp_errorhandling Error Handling
\section jkmp_errorhandling Error Handling
In the above example we use error handling by use of exception (default behauviour).
In the above example we use error handling by use of exception (default behauviour).
It is also possible to change the error handling from using exceptions to calling a specific
error handling function. This can be usefull in programs that don't support exceptions.
To do so, use this cod:
\code
void error(std::string message) {
cout<<"error: "+message;
system("PAUSE");
abort();
}
It is also possible to change the error handling from using exceptions to calling a specific
error handling function. This can be usefull in programs that don't support exceptions.
To do so, use this cod:
\code
void error(std::string message) {
cout<<"error: "+message;
system("PAUSE");
abort();
}
int main() {
jkMathParser mp;
mp.set_exception_function(error); // make error ahndler known
...
}
\endcode
int main() {
jkMathParser mp;
mp.set_exception_function(error); // make error ahndler known
...
}
\endcode
*/
class JKQTPMathParser
{
@ -247,8 +249,8 @@ class JKQTPMathParser
void* data;
/** \brief the possible tokens that can be recognized by the tokenizer in jkMathParser::getToken()
* \ingroup jkmpultil
*/
* \ingroup jkmpultil
*/
enum jkmpTokenType {
END, /*!< \brief end token */
PRINT, /*!< \brief a semicolon ';' */
@ -285,7 +287,7 @@ class JKQTPMathParser
/** \brief internal names for logic operations
* \ingroup jkmpultil */
* \ingroup jkmpultil */
enum {
jkmpLOPand='a',
jkmpLOPor='o',
@ -297,7 +299,7 @@ class JKQTPMathParser
/** \brief jkmpCOMPdefs internal names for compare operations
* \ingroup jkmpultil*/
* \ingroup jkmpultil*/
enum {
jkmpCOMPequal='=',
jkmpCOMPnequal='!',
@ -311,7 +313,7 @@ class JKQTPMathParser
public:
/** \brief possible result types
* \ingroup jkmpultil
* \ingroup jkmpultil
*/
enum jkmpResultType {jkmpDouble, /*!< \brief a floating-point number with double precision. This is also used to deal with integers */
jkmpString, /*!< \brief a string of characters */
@ -320,7 +322,7 @@ class JKQTPMathParser
/** \brief result of any expression
* \ingroup jkmpultil*/
* \ingroup jkmpultil*/
struct jkmpResult {
jkmpResult();
@ -354,7 +356,7 @@ class JKQTPMathParser
/** \brief This struct is for managing variables. Unlike jkmpResult this struct
* only contains pointers to the data
* \ingroup jkmpultil
* \ingroup jkmpultil
*/
struct jkmpVariable {
jkmpVariable();
@ -366,7 +368,7 @@ class JKQTPMathParser
};
/** \brief This struct is for managing temporary variables. It is generally like jkmpVariable.
* \ingroup jkmpultil
* \ingroup jkmpultil
*/
struct jkmpTempVariable {
std::string name; /*!< \brief name of the variable */
@ -418,7 +420,7 @@ class JKQTPMathParser
/**
* \brief This class is the abstract base class for nodes.
* All allowed node types must inherit from jkmpNode
* \ingroup jkmpNodes
* \ingroup jkmpNodes
*/
class jkmpNode {
protected:
@ -448,7 +450,7 @@ class JKQTPMathParser
/**
* \brief This class represents a binary arithmetic operation:
* add (+), subtract (-), multiply (*), divide (/), a to the power of b (a^b)
* \ingroup jkmpNodes
* \ingroup jkmpNodes
*/
class jkmpBinaryArithmeticNode: public jkmpNode {
private:
@ -473,7 +475,7 @@ class JKQTPMathParser
/**
* \brief This class represents a binary boolean operation: and, or, xor, nor, nand
* \ingroup jkmpNodes
* \ingroup jkmpNodes
*/
class jkmpBinaryBoolNode: public jkmpNode {
private:
@ -498,7 +500,7 @@ class JKQTPMathParser
/**
* \brief This class represents a binary compare operation: !=, ==, >=, <=, >, <
* \ingroup jkmpNodes
* \ingroup jkmpNodes
*/
class jkmpCompareNode: public jkmpNode {
private:
@ -523,7 +525,7 @@ class JKQTPMathParser
/**
* \brief This class represents a unary operations: ! (bool negation), - (arithmetic negation)
* \ingroup jkmpNodes
* \ingroup jkmpNodes
*/
class jkmpUnaryNode: public jkmpNode {
private:
@ -547,7 +549,7 @@ class JKQTPMathParser
/**
* \brief This class represents a variable assignment (a = expression)
* \ingroup jkmpNodes
* \ingroup jkmpNodes
*/
class jkmpVariableAssignNode: public jkmpNode {
private:
@ -572,7 +574,7 @@ class JKQTPMathParser
/**
* \brief This class represents a number, a string contant or a boolean contant (true/false)
* \ingroup jkmpNodes
* \ingroup jkmpNodes
*/
class jkmpConstantNode: public jkmpNode {
private:
@ -591,7 +593,7 @@ class JKQTPMathParser
/**
* \brief This class represents a variable.
* \ingroup jkmpNodes
* \ingroup jkmpNodes
*/
class jkmpVariableNode: public jkmpNode {
private:
@ -610,7 +612,7 @@ class JKQTPMathParser
/**
* \brief This class represents an arbitrary function.
* \ingroup jkmpNodes
* \ingroup jkmpNodes
*
* When initialized this class will get the function description that is
* linked to the supplied function name from jkMathParser object. This
@ -643,7 +645,7 @@ class JKQTPMathParser
/**
* \brief This class represents a list of jkmpNode.
* \ingroup jkmpNodes
* \ingroup jkmpNodes
*
* when evaluating the result will be the result of the last node in the list.
*/
@ -679,7 +681,7 @@ class JKQTPMathParser
/** \brief error handling: exceptions of the type of this class will be thrown if an error occurs
* \ingroup jkmpErrorhandling
* \ingroup jkmpErrorhandling
*
* \attention If you do not want to use the exception handling which throws
* jkmpException exceptions, but want to write your own error handling, you should write your own
@ -714,12 +716,12 @@ class JKQTPMathParser
};
/** \brief type for a custom error handler. This an alternative error handling
* \ingroup jkmpErrorhandling */
* \ingroup jkmpErrorhandling */
typedef void (*jkmpexceptionf)(std::string);
/** \brief function that throws an exception or calls an error handler
* \ingroup jkmpErrorhandling */
* \ingroup jkmpErrorhandling */
inline void jkmpError(std::string st) {
if (jkmathparser_exception_function!=nullptr) {
jkmathparser_exception_function(st);
@ -730,18 +732,18 @@ class JKQTPMathParser
private:
/** \brief if this is nullptr then an exception may be thrown otherwise this should point to an error handler that will be called.
* \ingroup jkmpErrorhandling */
* \ingroup jkmpErrorhandling */
jkmpexceptionf jkmathparser_exception_function;
public:
/** \brief activate error handling by use of an exception function
* \ingroup jkmpErrorhandling */
* \ingroup jkmpErrorhandling */
inline void set_exception_function(jkmpexceptionf exception_function) {
jkmathparser_exception_function=exception_function;
}
/** \brief deactivate error handling by use of an exception function
* \ingroup jkmpErrorhandling */
* \ingroup jkmpErrorhandling */
inline void reset_exception_function() {
jkmathparser_exception_function=nullptr;
}
@ -754,38 +756,38 @@ class JKQTPMathParser
/** \brief return the current token as human-readable string */
std::string currenttokentostring();
/** \brief Tokenizer: extract the next token from the input */
jkmpTokenType getToken();
/** \brief Tokenizer: extract the next token from the input */
jkmpTokenType getToken();
/** \brief return a delimited text, i.e. extract the texte between the delimiters <code>"</code> in: of <code>"Hallo!"</code>, i.e. returns <code> Hallo!</code>
/** \brief return a delimited text, i.e. extract the texte between the delimiters <code>"</code> in: of <code>"Hallo!"</code>, i.e. returns <code> Hallo!</code>
* This is used to parse string constants.
*
* This functions actually reads pascal style delimited string constants. So if you want to use the delimiter as part of the string you will have to
* write it as doubled character. So <code>'Jan''s Test'</code> stands for <code>Jan's Test</code>.
*/
std::string readDelim(char delimiter);
std::string readDelim(char delimiter);
/** \brief recognizes an compExpression while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
jkmpNode* compExpression(bool get);
/** \brief recognizes an compExpression while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
jkmpNode* compExpression(bool get);
/** \brief recognizes a logicalExpression while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
jkmpNode* logicalExpression(bool get);
/** \brief recognizes a logicalExpression while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
jkmpNode* logicalExpression(bool get);
/** \brief recognizes a logicalTerm while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
jkmpNode* logicalTerm(bool get);
/** \brief recognizes a logicalTerm while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
jkmpNode* logicalTerm(bool get);
/** \brief recognizes a mathExpression while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
jkmpNode* mathExpression(bool get);
/** \brief recognizes a mathExpression while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
jkmpNode* mathExpression(bool get);
/** \brief recognizes a term while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
jkmpNode* mathTerm(bool get);
/** \brief recognizes a term while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
jkmpNode* mathTerm(bool get);
/** \brief recognizes a primary while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
jkmpNode* primary(bool get);
/** \brief recognizes a primary while parsing. If \a get ist \c true, this function first retrieves a new token by calling getToken() */
jkmpNode* primary(bool get);
/** \brief this stream is used to read in the program. An object is created and assigned
* (and destroyed) by the parse()-function */
std::istringstream* program;
/** \brief this stream is used to read in the program. An object is created and assigned
* (and destroyed) by the parse()-function */
std::istringstream* program;
/** \brief vector containing all temporary variables */
std::vector<jkmpTempVariable> tempvariables;
@ -814,15 +816,15 @@ class JKQTPMathParser
/** \brief adds a temporary variable */
void addTempVariable(std::string name, jkmpResult value);
protected:
int argc;
char **argv;
protected:
int argc;
char **argv;
public:
/** \brief class constructor */
public:
/** \brief class constructor */
JKQTPMathParser();
/** \brief class destructor */
/** \brief class destructor */
virtual ~JKQTPMathParser();
/*! \brief sets the property data to the specified \a __value.
@ -840,42 +842,42 @@ class JKQTPMathParser
return this->data;
}
/** \brief register a new function
* \param name name of the new function
* \param function a pointer to the implementation
*/
void addFunction(std::string name, jkmpEvaluateFunc function);
/** \brief register a new function
* \param name name of the new function
* \param function a pointer to the implementation
*/
void addFunction(std::string name, jkmpEvaluateFunc function);
/** \brief register a new external variable of type double
* \param name name of the new variable
* \param v pointer to the variable memory
*/
void addVariableDouble(std::string name, double* v);
/** \brief register a new external variable of type double
* \param name name of the new variable
* \param v pointer to the variable memory
*/
void addVariableDouble(std::string name, double* v);
/** \brief register a new external variable of type string
* \param name name of the new variable
* \param v pointer to the variable memory
*/
void addVariableString(std::string name, std::string* v);
/** \brief register a new external variable of type string
* \param name name of the new variable
* \param v pointer to the variable memory
*/
void addVariableString(std::string name, std::string* v);
/** \brief register a new external variable of type boolean
* \param name name of the new variable
* \param v pointer to the variable memory
*/
void addVariableBoolean(std::string name, bool* v);
/** \brief register a new external variable of type boolean
* \param name name of the new variable
* \param v pointer to the variable memory
*/
void addVariableBoolean(std::string name, bool* v);
/** \brief register a new internal variable of type double
* \param name name of the new variable
* \param v initial value of this variable
*/
void addVariableDouble(std::string name, double v);
/** \brief register a new internal variable of type double
* \param name name of the new variable
* \param v initial value of this variable
*/
void addVariableDouble(std::string name, double v);
/** \brief register a new internal variable of type string
* \param name name of the new variable
* \param v initial value of this variable
*/
void addVariableString(std::string name, std::string v);
/** \brief register a new internal variable of type string
* \param name name of the new variable
* \param v initial value of this variable
*/
void addVariableString(std::string name, std::string v);
/** \brief register a new internal variable of type boolean
* \param name name of the new variable
@ -951,14 +953,14 @@ class JKQTPMathParser
/** \brief prints a list of all registered variables */
void printVariables();
/** \brief returns all registered variables */
/** \brief returns all registered variables */
std::vector<std::pair<std::string, jkmpVariable> > getVariables();
/** \brief store programs command-line arguments, so they are available in the parser */
void setArgCV(int argc, char **argv);
/** \brief store programs command-line arguments, so they are available in the parser */
void setArgCV(int argc, char **argv);
/** \brief return one of programs command-line arguments, or \a defaultResult if it is not present */
std::string getArgCVParam(std::string name, std::string defaultResult);
/** \brief return one of programs command-line arguments, or \a defaultResult if it is not present */
std::string getArgCVParam(std::string name, std::string defaultResult);
};
#endif // JKQTPMATHPARSER_H

View File

@ -46,7 +46,7 @@ Scatter Plots can have symbols where the shape/color/size is parametrized by a d
## QuickFit 3.0 Screenshots
The library JKQtPlotter was developed initially as a central part of the data evaluation software for biophysics [QuickFit 3.0](https://github.com/jkriege2/QuickFit3). The latter makes heavy use of `JKQtPlotter`, `JKQtMathText` and `JKQtFastPlotter`:
The library JKQtPlotter was developed initially as a central part of the data evaluation software for biophysics [QuickFit 3.0](https://github.com/jkriege2/QuickFit3). The latter makes heavy use of `JKQtPlotter`, `JKQTmathText` and `JKQtFastPlotter`:
![QuickFit 3.0 Screenshot](./QF3_screen_dcalc.png)
![QuickFit 3.0 Screenshot](./QF3_screen_fccsfit.png)