STOFFStarMathToMMLConverter.hxx Source File documentation

STOFFStarMathToMMLConverter.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
3 /* libstaroffice
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33
34 #ifndef STOFF_STARMATHTOMML_CONVERTER_H
35 #define STOFF_STARMATHTOMML_CONVERTER_H
36
37 #include "libstaroffice_internal.hxx"
38
40 class STOFFStarMathToMMLConverter
41 {
42 public:
44 STOFFStarMathToMMLConverter()
45 {
46 }
47
49 static bool convertStarMath(librevenge::RVNGString const &starMath, librevenge::RVNGString &mml);
50 };
51
52 #endif
53 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
STOFFStarMathToMMLConverterInternal::Node::Root
@ Root
Definition: STOFFStarMathToMMLConverter.cxx:90
STOFFStarMathToMMLConverterInternal::Parser::elementExpr
std::shared_ptr< Node > elementExpr(size_t &pos) const
try to parse a element expr:
Definition: STOFFStarMathToMMLConverter.cxx:1251
STOFFStarMathToMMLConverterInternal::Node::Empty
@ Empty
Definition: STOFFStarMathToMMLConverter.cxx:90
STOFFStarMathToMMLConverterInternal::LexerData::String
@ String
Definition: STOFFStarMathToMMLConverter.cxx:75
STOFFStarMathToMMLConverterInternal::Node::operator<<
friend std::ostream & operator<<(std::ostream &o, Node const &nd)
operator<<
Definition: STOFFStarMathToMMLConverter.cxx:108
STOFFStarMathToMMLConverterInternal::LexerData::Type
Type
the different lexer type
Definition: STOFFStarMathToMMLConverter.cxx:75
STOFFStarMathToMMLConverterInternal::Node::m_function
std::string m_function
the function
Definition: STOFFStarMathToMMLConverter.cxx:130
STOFFStarMathToMMLConverterInternal::Parser::unaryOperatorExpr
std::shared_ptr< Node > unaryOperatorExpr(size_t &pos, bool inPosition=false) const
try to parse a unary operator expr:
Definition: STOFFStarMathToMMLConverter.cxx:917
STOFFStarMathToMMLConverterInternal::Parser::getEscapedString
static std::string getEscapedString(std::string const &str)
html escape a string
Definition: STOFFStarMathToMMLConverter.cxx:444
STOFFStarMathToMMLConverterInternal::Parser::findAndAddAlignment
void findAndAddAlignment(Node &node, bool &colFound, bool &rowFound)
try to add the alignment
Definition: STOFFStarMathToMMLConverter.cxx:1289
STOFFStarMathToMMLConverterInternal::Node::Function
@ Function
Definition: STOFFStarMathToMMLConverter.cxx:93
STOFFStarMathToMMLConverterInternal::Parser::m_multiplicationStringMap
std::map< std::string, std::string > m_multiplicationStringMap
multiplication symbol string operator
Definition: STOFFStarMathToMMLConverter.cxx:549
STOFF_DEBUG_MSG
#define STOFF_DEBUG_MSG(M)
Definition: libstaroffice_internal.hxx:129
STOFFStarMathToMMLConverterInternal::Parser::m_additionSet
std::set< std::string > m_additionSet
addition symbol operator
Definition: STOFFStarMathToMMLConverter.cxx:551
STOFFStarMathToMMLConverterInternal::Parser::relationExpr
std::shared_ptr< Node > relationExpr(size_t &pos) const
try to parse an relation expr: additionExpr{[=,==,...]additionExpr}
Definition: STOFFStarMathToMMLConverter.cxx:682
STOFFStarMathToMMLConverterInternal::LexerData::m_type
Type m_type
the main type
Definition: STOFFStarMathToMMLConverter.cxx:83
STOFFStarMathToMMLConverterInternal::Parser::m_unaryOperatorMap
std::map< std::string, std::string > m_unaryOperatorMap
the unary operator
Definition: STOFFStarMathToMMLConverter.cxx:533
STOFFStarMathToMMLConverterInternal::Node::m_spaces
std::string m_spaces
the different spaces
Definition: STOFFStarMathToMMLConverter.cxx:128
STOFFStarMathToMMLConverterInternal::Node::ParenthesisLeft
@ ParenthesisLeft
Definition: STOFFStarMathToMMLConverter.cxx:95
STOFFStarMathToMMLConverter.hxx
STOFFStarMathToMMLConverterInternal::Parser::leftParenthesisExpr
std::shared_ptr< Node > leftParenthesisExpr(size_t &pos, std::function< std::shared_ptr< Node >(size_t &)> function) const
look for alone left parenthesis
Definition: STOFFStarMathToMMLConverter.cxx:1196
STOFFStarMathToMMLConverterInternal::Node::Relation
@ Relation
Definition: STOFFStarMathToMMLConverter.cxx:92
STOFFStarMathToMMLConverterInternal::LexerData
a lexer data
Definition: STOFFStarMathToMMLConverter.cxx:73
STOFFStarMathToMMLConverterInternal::Parser::m_otherSpecialMap
std::map< std::string, std::string > m_otherSpecialMap
the remaining special key word
Definition: STOFFStarMathToMMLConverter.cxx:525
STOFFStarMathToMMLConverterInternal::Parser::ignoreSpaces
void ignoreSpaces(size_t &pos) const
ignore the following space
Definition: STOFFStarMathToMMLConverter.cxx:489
STOFFStarMathToMMLConverterInternal::Parser::m_multiplicationMap
std::map< std::string, std::string > m_multiplicationMap
multiplication symbol operator
Definition: STOFFStarMathToMMLConverter.cxx:547
STOFFStarMathToMMLConverterInternal::Parser::m_parenthesisRightSet
std::set< std::string > m_parenthesisRightSet
the parenthesis right map
Definition: STOFFStarMathToMMLConverter.cxx:529
STOFFStarMathToMMLConverterInternal::Parser::additionExpr
std::shared_ptr< Node > additionExpr(size_t &pos) const
try to parse an addition expr: multiplyExpr{[+,-,in,or,...]multiplyExpr}
Definition: STOFFStarMathToMMLConverter.cxx:730
STOFFStarMathToMMLConverterInternal::toLower
std::string toLower(std::string const &strToConvert)
Definition: STOFFStarMathToMMLConverter.cxx:57
STOFFStarMathToMMLConverterInternal::Parser::functionExpr
std::shared_ptr< Node > functionExpr(size_t &pos, bool inPosition=false) const
try to parse a function expr: blockExpr | unaryOpExpr
Definition: STOFFStarMathToMMLConverter.cxx:944
STOFFStarMathToMMLConverterInternal::LexerData::PlaceHolder
@ PlaceHolder
Definition: STOFFStarMathToMMLConverter.cxx:75
STOFFStarMathToMMLConverterInternal::Parser::m_function1Set
std::set< std::string > m_function1Set
the function which have one argument
Definition: STOFFStarMathToMMLConverter.cxx:535
STOFFStarMathToMMLConverterInternal::Node::Node
Node(Type type=Unknown, std::string const &spaces="")
constructor
Definition: STOFFStarMathToMMLConverter.cxx:99
libstaroffice_internal.hxx
STOFFStarMathToMMLConverterInternal::Parser::ignoreSpaces
void ignoreSpaces(size_t &pos, std::string &spaces) const
ignore the following space
Definition: STOFFStarMathToMMLConverter.cxx:495
STOFFStarMathToMMLConverterInternal::Node::m_data
std::string m_data
the data
Definition: STOFFStarMathToMMLConverter.cxx:132
STOFFStarMathToMMLConverterInternal::Parser::m_fontSize
double m_fontSize
the current font size
Definition: STOFFStarMathToMMLConverter.cxx:509
STOFFStarMathToMMLConverterInternal::LexerData::Unknown
@ Unknown
Definition: STOFFStarMathToMMLConverter.cxx:75
STOFFStarMathToMMLConverterInternal::Parser::m_accent1Map
std::map< std::string, std::string > m_accent1Map
the accent which have one argument
Definition: STOFFStarMathToMMLConverter.cxx:541
STOFFStarMathToMMLConverterInternal::Node::ParenthesisRight
@ ParenthesisRight
Definition: STOFFStarMathToMMLConverter.cxx:95
STOFFStarMathToMMLConverterInternal::Parser::m_additionStringMap
std::map< std::string, std::string > m_additionStringMap
addition symbol string operator
Definition: STOFFStarMathToMMLConverter.cxx:553
STOFFStarMathToMMLConverterInternal::Node::Unknown
@ Unknown
Definition: STOFFStarMathToMMLConverter.cxx:90
STOFFStarMathToMMLConverterInternal::Parser::convertPositionUnderbraceInMML
bool convertPositionUnderbraceInMML(Node const &node)
try to convert a position node in a starMML
Definition: STOFFStarMathToMMLConverter.cxx:1827
STOFFStarMathToMMLConverterInternal::LexerData::Space
@ Space
Definition: STOFFStarMathToMMLConverter.cxx:75
STOFFStarMathToMMLConverterInternal::Parser::m_italic
bool m_italic
a flag to know if we are in italic or not
Definition: STOFFStarMathToMMLConverter.cxx:513
STOFFStarMathToMMLConverterInternal::Parser::m_fontName
std::string m_fontName
the font name
Definition: STOFFStarMathToMMLConverter.cxx:515
STOFFStarMathToMMLConverterInternal::Parser::positionExpr
std::shared_ptr< Node > positionExpr(size_t &pos) const
try to parse a position expr: functionExpr{[^,_,sub,sup]functionExpr} first child is sub,...
Definition: STOFFStarMathToMMLConverter.cxx:828
STOFFStarMathToMMLConverterInternal::LexerData::Number
@ Number
Definition: STOFFStarMathToMMLConverter.cxx:75
STOFFStarMathToMMLConverterInternal::Parser::m_positionMap
std::map< std::string, int > m_positionMap
position symbol map
Definition: STOFFStarMathToMMLConverter.cxx:545
STOFFStarMathToMMLConverterInternal::Parser::m_output
std::stringstream m_output
the output stream
Definition: STOFFStarMathToMMLConverter.cxx:507
STOFFStarMathToMMLConverterInternal::Parser::m_function2Set
std::set< std::string > m_function2Set
the function which have two argument
Definition: STOFFStarMathToMMLConverter.cxx:537
STOFFStarMathToMMLConverterInternal::Parser::sequenceExpr
std::shared_ptr< Node > sequenceExpr(size_t &pos, bool newLineIsBad=false, int stackOrMatrixType=0) const
try to parse a sequence of expr
Definition: STOFFStarMathToMMLConverter.cxx:625
STOFFStarMathToMMLConverterInternal::Parser::m_dataList
std::vector< LexerData > m_dataList
the star math data
Definition: STOFFStarMathToMMLConverter.cxx:505
STOFFStarMathToMMLConverterInternal::Node::Position
@ Position
Definition: STOFFStarMathToMMLConverter.cxx:92
STOFFStarMathToMMLConverterInternal::LexerData::Special
@ Special
Definition: STOFFStarMathToMMLConverter.cxx:75
STOFFStarMathToMMLConverterInternal::Parser::expr
std::shared_ptr< Node > expr() const
try to parse an expr: {newline|sequenceExpr}*
Definition: STOFFStarMathToMMLConverter.cxx:560
STOFFStarMathToMMLConverterInternal::Parser::m_integralMap
std::map< std::string, std::string > m_integralMap
the function which have one to three argument (from to optional)
Definition: STOFFStarMathToMMLConverter.cxx:539
STOFFStarMathToMMLConverterInternal::Parser::m_colorSet
std::set< std::string > m_colorSet
the set of potential color
Definition: STOFFStarMathToMMLConverter.cxx:517
STOFFStarMathToMMLConverterInternal::Parser::parse
bool parse(librevenge::RVNGString const &formula, librevenge::RVNGString &res)
try to parse a StarMath string
Definition: STOFFStarMathToMMLConverter.cxx:1909
STOFFStarMathToMMLConverterInternal::Node::Type
Type
the node type
Definition: STOFFStarMathToMMLConverter.cxx:90
STOFFStarMathToMMLConverterInternal::Parser::convertInMML
bool convertInMML(Node const &node, bool inRow=false)
try to convert a node in a starMML
Definition: STOFFStarMathToMMLConverter.cxx:1333
STOFFStarMathToMMLConverterInternal::Node::String
@ String
Definition: STOFFStarMathToMMLConverter.cxx:96
STOFFStarMathToMMLConverterInternal::Parser::m_specialPercentMap
std::map< std::string, std::string > m_specialPercentMap
the special percent convert map
Definition: STOFFStarMathToMMLConverter.cxx:523
STOFFStarMathToMMLConverterInternal::Node::Sequence
@ Sequence
Definition: STOFFStarMathToMMLConverter.cxx:91
STOFFStarMathToMMLConverterInternal::icmp
static bool icmp(const std::string &str1, const std::string &str2)
insenstive comparison
Definition: STOFFStarMathToMMLConverter.cxx:47
STOFFStarMathToMMLConverterInternal
namespace to define a basic lexer, parser
Definition: STOFFStarMathToMMLConverter.cxx:44
STOFFStarMathToMMLConverter::STOFFStarMathToMMLConverter
STOFFStarMathToMMLConverter()
constructor
Definition: STOFFStarMathToMMLConverter.hxx:44
STOFFStarMathToMMLConverterInternal::Parser::m_accent1Set
std::set< std::string > m_accent1Set
the accent which have one argument
Definition: STOFFStarMathToMMLConverter.cxx:543
STOFFStarMathToMMLConverterInternal::Node::m_type
Type m_type
the node type
Definition: STOFFStarMathToMMLConverter.cxx:126
STOFFStarMathToMMLConverterInternal::Parser::m_relationMap
std::map< std::string, std::string > m_relationMap
relation symbol operator
Definition: STOFFStarMathToMMLConverter.cxx:555
STOFFStarMathToMMLConverterInternal::Node::Special
@ Special
Definition: STOFFStarMathToMMLConverter.cxx:96
STOFFStarMathToMMLConverterInternal::Parser::sendMathVariant
bool sendMathVariant()
try to send the font style
Definition: STOFFStarMathToMMLConverter.cxx:1274
STOFFStarMathToMMLConverterInternal::Node::Accent
@ Accent
Definition: STOFFStarMathToMMLConverter.cxx:93
STOFFStarMathToMMLConverterInternal::Node::Multiplication
@ Multiplication
Definition: STOFFStarMathToMMLConverter.cxx:92
STOFFStarMathToMMLConverterInternal::Parser::m_bold
bool m_bold
a flag to know if we are in bold or not
Definition: STOFFStarMathToMMLConverter.cxx:511
STOFFStarMathToMMLConverterInternal::Parser::Parser
Parser()
constructor
Definition: STOFFStarMathToMMLConverter.cxx:142
STOFFStarMathToMMLConverterInternal::Node::Number
@ Number
Definition: STOFFStarMathToMMLConverter.cxx:96
STOFFStarMathToMMLConverterInternal::Node::m_childs
std::vector< std::shared_ptr< Node > > m_childs
list of child
Definition: STOFFStarMathToMMLConverter.cxx:134
STOFFStarMathToMMLConverterInternal::Parser::m_relationStringMap
std::map< std::string, std::string > m_relationStringMap
relation symbol string operator
Definition: STOFFStarMathToMMLConverter.cxx:557
STOFFStarMathToMMLConverterInternal::Parser::convertPositionOverbraceInMML
bool convertPositionOverbraceInMML(Node const &node)
try to convert a position node in a starMML
Definition: STOFFStarMathToMMLConverter.cxx:1813
STOFFStarMathToMMLConverterInternal::Parser::m_greekMap
std::map< std::string, std::string > m_greekMap
the greek convert map
Definition: STOFFStarMathToMMLConverter.cxx:521
STOFFStarMathToMMLConverterInternal::Parser::rightParenthesisExpr
std::shared_ptr< Node > rightParenthesisExpr(size_t &pos, std::shared_ptr< Node > term) const
look for alone right parenthesis
Definition: STOFFStarMathToMMLConverter.cxx:1226
STOFFStarMathToMMLConverter
basic class to convert a StarMath formula in MML
Definition: STOFFStarMathToMMLConverter.hxx:40
STOFFStarMathToMMLConverterInternal::Parser::m_parenthesisToStringMap
std::map< std::string, std::string > m_parenthesisToStringMap
the parenthesis unicode map
Definition: STOFFStarMathToMMLConverter.cxx:531
STOFFStarMathToMMLConverterInternal::LexerData::LexerData
LexerData()
constructor
Definition: STOFFStarMathToMMLConverter.cxx:77
STOFFStarMathToMMLConverterInternal::Parser::multiplicationExpr
std::shared_ptr< Node > multiplicationExpr(size_t &pos) const
try to parse an multiplication expr: positionExpr{[*,/,over,...]positionExpr}
Definition: STOFFStarMathToMMLConverter.cxx:766
STOFFStarMathToMMLConverterInternal::LexerData::m_string
std::string m_string
the data
Definition: STOFFStarMathToMMLConverter.cxx:85
STOFFStarMathToMMLConverterInternal::Node
a data node
Definition: STOFFStarMathToMMLConverter.cxx:88
STOFFStarMathToMMLConverter::convertStarMath
static bool convertStarMath(librevenge::RVNGString const &starMath, librevenge::RVNGString &mml)
try to convert a StarMath formula to a MML formula
Definition: STOFFStarMathToMMLConverter.cxx:2110
STOFFStarMathToMMLConverterInternal::Node::SequenceRow
@ SequenceRow
Definition: STOFFStarMathToMMLConverter.cxx:91
STOFFStarMathToMMLConverterInternal::Parser::parenthesisExpr
std::shared_ptr< Node > parenthesisExpr(size_t &pos) const
try to parse a parenthesis expr:
Definition: STOFFStarMathToMMLConverter.cxx:1123
STOFFStarMathToMMLConverterInternal::toUpper
std::string toUpper(std::string const &strToConvert)
Definition: STOFFStarMathToMMLConverter.cxx:64
STOFFStarMathToMMLConverterInternal::Parser::m_parenthesisMap
std::map< std::string, std::string > m_parenthesisMap
the parenthesis left/right map
Definition: STOFFStarMathToMMLConverter.cxx:527
STOFFStarMathToMMLConverterInternal::Parser::convert
bool convert(librevenge::RVNGString const &starMath, std::vector< LexerData > &lexList) const
convert a StarMath string in a list of lexer data.
Definition: STOFFStarMathToMMLConverter.cxx:1939
STOFFStarMathToMMLConverterInternal::Node::Addition
@ Addition
Definition: STOFFStarMathToMMLConverter.cxx:92
STOFFStarMathToMMLConverterInternal::Parser
class to parse a StarMath string
Definition: STOFFStarMathToMMLConverter.cxx:138
STOFFStarMathToMMLConverterInternal::Node::UnaryOperator
@ UnaryOperator
Definition: STOFFStarMathToMMLConverter.cxx:94
STOFFStarMathToMMLConverterInternal::Node::Integral
@ Integral
Definition: STOFFStarMathToMMLConverter.cxx:93
STOFFStarMathToMMLConverterInternal::Parser::m_fontMap
std::map< std::string, std::string > m_fontMap
the font convert map
Definition: STOFFStarMathToMMLConverter.cxx:519
STOFFStarMathToMMLConverterInternal::Node::Parenthesis
@ Parenthesis
Definition: STOFFStarMathToMMLConverter.cxx:95
STOFFStarMathToMMLConverterInternal::Parser::convertPositionInMML
bool convertPositionInMML(Node const &node)
try to convert a position node in a starMML
Definition: STOFFStarMathToMMLConverter.cxx:1841