mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Cleanup MathMLStream
This is preparatory work for fixing ticket #13069. Remove direct accesses to the underlying stream of MathMLStream in InsetMathChar, InsetMathSpecialChar, and in all << operators other than MathMLStream << docstring. This will allow to add a hook later in this operator. Move default values of MathMLStream private members to their definition. Get rid of line_ member, which is not used.
This commit is contained in:
parent
d7ba7bceb3
commit
fbd4b0a13f
@ -248,7 +248,7 @@ void InsetMathChar::mathmlize(MathMLStream & ms) const
|
||||
|
||||
if (ms.inText()) {
|
||||
if (entity.empty())
|
||||
ms.os().put(char_);
|
||||
ms << char_;
|
||||
else
|
||||
ms << from_ascii(entity);
|
||||
return;
|
||||
|
@ -139,7 +139,7 @@ void InsetMathSpecialChar::mathmlize(MathMLStream & ms) const
|
||||
ms << "&";
|
||||
break;
|
||||
default:
|
||||
ms.os().put(char_);
|
||||
ms << char_;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ TeXMathStream & operator<<(TeXMathStream & ws, unsigned int i)
|
||||
|
||||
|
||||
MathMLStream::MathMLStream(odocstream & os, std::string const & xmlns)
|
||||
: os_(os), tab_(0), line_(0), in_text_(false), xmlns_(xmlns)
|
||||
: os_(os), xmlns_(xmlns)
|
||||
{
|
||||
if (in_text_)
|
||||
font_math_style_ = TEXT_STYLE;
|
||||
@ -338,23 +338,30 @@ MathMLStream & operator<<(MathMLStream & ms, MathData const & ar)
|
||||
}
|
||||
|
||||
|
||||
MathMLStream & operator<<(MathMLStream & ms, char const * s)
|
||||
MathMLStream & operator<<(MathMLStream & ms, docstring const & s)
|
||||
{
|
||||
ms.os() << s;
|
||||
return ms;
|
||||
}
|
||||
|
||||
|
||||
MathMLStream & operator<<(MathMLStream & ms, char const * s)
|
||||
{
|
||||
ms << from_utf8(s);
|
||||
return ms;
|
||||
}
|
||||
|
||||
|
||||
MathMLStream & operator<<(MathMLStream & ms, char c)
|
||||
{
|
||||
ms.os() << c;
|
||||
ms << docstring(1,c);
|
||||
return ms;
|
||||
}
|
||||
|
||||
|
||||
MathMLStream & operator<<(MathMLStream & ms, char_type c)
|
||||
{
|
||||
ms.os().put(c);
|
||||
ms << docstring(1,c);
|
||||
return ms;
|
||||
}
|
||||
|
||||
@ -410,13 +417,6 @@ MathMLStream & operator<<(MathMLStream & ms, CTag const & t)
|
||||
}
|
||||
|
||||
|
||||
MathMLStream & operator<<(MathMLStream & ms, docstring const & s)
|
||||
{
|
||||
ms.os() << s;
|
||||
return ms;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
@ -9,8 +9,8 @@
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef MATH_MATHMLSTREAM_H
|
||||
#define MATH_MATHMLSTREAM_H
|
||||
#ifndef MATH_MATHSTREAM_H
|
||||
#define MATH_MATHSTREAM_H
|
||||
|
||||
#include "InsetMath.h"
|
||||
#include "FontInfo.h"
|
||||
@ -382,13 +382,9 @@ public:
|
||||
void cr();
|
||||
///
|
||||
odocstream & os() { return os_; }
|
||||
///
|
||||
int line() const { return line_; }
|
||||
///
|
||||
/// Indentation when nesting tags
|
||||
int & tab() { return tab_; }
|
||||
///
|
||||
friend MathMLStream & operator<<(MathMLStream &, char const *);
|
||||
///
|
||||
void defer(docstring const &);
|
||||
///
|
||||
void defer(std::string const &);
|
||||
@ -412,11 +408,9 @@ private:
|
||||
///
|
||||
odocstream & os_;
|
||||
///
|
||||
int tab_;
|
||||
int tab_ = 0;
|
||||
///
|
||||
int line_;
|
||||
///
|
||||
bool in_text_;
|
||||
bool in_text_ = false;
|
||||
///
|
||||
odocstringstream deferred_;
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user