From: André Pönitz Date: Mon, 3 Dec 2001 17:52:48 +0000 (+0000) Subject: do as Lars says X-Git-Tag: 1.6.10~20236 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=ef9efa6c0d48fab3fcaef7af441e00ad0e21d3ed;p=features.git do as Lars says git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3142 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/Makefile.am b/src/mathed/Makefile.am index b077bc6cb2..4a624d3188 100644 --- a/src/mathed/Makefile.am +++ b/src/mathed/Makefile.am @@ -111,6 +111,7 @@ libmathed_la_SOURCES = \ math_sqrtinset.h \ math_stackrelinset.C \ math_stackrelinset.h \ + math_streamstr.C \ math_streamstr.h \ math_stringinset.C \ math_stringinset.h \ diff --git a/src/mathed/math_gridinset.C b/src/mathed/math_gridinset.C index 893c5a06c2..7c7bafd22e 100644 --- a/src/mathed/math_gridinset.C +++ b/src/mathed/math_gridinset.C @@ -3,6 +3,7 @@ #endif #include "math_gridinset.h" +#include "math_mathmlstream.h" #include "math_streamstr.h" #include "lyxfont.h" #include "Painter.h" diff --git a/src/mathed/math_mathmlstream.C b/src/mathed/math_mathmlstream.C index f4e9ad4f92..03bc1b2ccb 100644 --- a/src/mathed/math_mathmlstream.C +++ b/src/mathed/math_mathmlstream.C @@ -1,4 +1,5 @@ #include +#include #include "math_mathmlstream.h" #include "math_inset.h" @@ -213,10 +214,7 @@ WriteStream & operator<<(WriteStream & ws, MathArray const & ar) WriteStream & operator<<(WriteStream & ws, char const * s) { ws.os() << s; - for ( ; *s ; ++s) { - if (*s == '\n') - ++ws.line(); - } + ws.line() += std::count(s, s + strlen(s), '\n'); return ws; } diff --git a/src/mathed/math_streamstr.C b/src/mathed/math_streamstr.C new file mode 100644 index 0000000000..5886fb6d1b --- /dev/null +++ b/src/mathed/math_streamstr.C @@ -0,0 +1,13 @@ +#include +#include + +#include "math_mathmlstream.h" +#include "math_streamstr.h" + + +WriteStream & operator<<(WriteStream & ws, string const & s) +{ + ws.os() << s; + ws.line() += std::count(s.begin(), s.end(), '\n'); + return ws; +} diff --git a/src/mathed/math_streamstr.h b/src/mathed/math_streamstr.h index bd4d4ef66d..2d54ecbe97 100644 --- a/src/mathed/math_streamstr.h +++ b/src/mathed/math_streamstr.h @@ -2,16 +2,13 @@ #define MATH_STREAMSTR_H #include "LString.h" -#include "math_mathmlstream.h" + +class WriteStream; // // writing strings directly // -inline WriteStream & operator<<(WriteStream & ws, string const & s) -{ - ws << s.c_str(); - return ws; -} +WriteStream & operator<<(WriteStream & ws, string const & s); #endif