[LyX/2.4.x] Cleanup MathMLStream
Enrico Forestieri
forenr at lyx.org
Mon Jul 22 20:40:44 UTC 2024
On Mon, Jul 22, 2024 at 08:09:19PM +0000, Jean-Marc Lasgouttes wrote:
>
>commit 17bc6d05b327034c2034087978c2ebf9f8d9e469
>Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
>Date: Fri Jul 19 14:57:58 2024 +0200
>
> 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.
>
> (cherry picked from commit fbd4b0a13fae4263cc88aa76bc4fbba5178b15fa)
>---
> src/mathed/InsetMathChar.cpp | 2 +-
> src/mathed/InsetMathSpecialChar.cpp | 2 +-
> src/mathed/MathStream.cpp | 22 +++++++++++-----------
> src/mathed/MathStream.h | 16 +++++-----------
> 4 files changed, 18 insertions(+), 24 deletions(-)
>
>diff --git a/src/mathed/InsetMathChar.cpp b/src/mathed/InsetMathChar.cpp
>index 199982a5f7..82d0b63f1e 100644
>--- a/src/mathed/InsetMathChar.cpp
>+++ b/src/mathed/InsetMathChar.cpp
>@@ -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;
>diff --git a/src/mathed/InsetMathSpecialChar.cpp b/src/mathed/InsetMathSpecialChar.cpp
>index 746cec5bda..12c9a4c111 100644
>--- a/src/mathed/InsetMathSpecialChar.cpp
>+++ b/src/mathed/InsetMathSpecialChar.cpp
>@@ -139,7 +139,7 @@ void InsetMathSpecialChar::mathmlize(MathMLStream & ms) const
> ms << "&";
> break;
> default:
>- ms.os().put(char_);
>+ ms << char_;
> break;
> }
> }
I don't understand the need for the two changes above. Note that on
systems where sizeof(wchar_t) == 2, lyx::char_type is defined as a
32-bit value. So, with the above changes, char_ will be output as a
number rather than a character.
--
Enrico
More information about the lyx-devel
mailing list