]> git.lyx.org Git - features.git/commitdiff
do as Lars says
authorAndré Pönitz <poenitz@gmx.net>
Mon, 3 Dec 2001 17:52:48 +0000 (17:52 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Mon, 3 Dec 2001 17:52:48 +0000 (17:52 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3142 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/Makefile.am
src/mathed/math_gridinset.C
src/mathed/math_mathmlstream.C
src/mathed/math_streamstr.C [new file with mode: 0644]
src/mathed/math_streamstr.h

index b077bc6cb2e55ac52d829a022dd9109c1793eb4b..4a624d3188018ab7f3807e75082af4cc9846b01a 100644 (file)
@@ -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 \
index 893c5a06c20c69218a156c2e322bc8078946acb3..7c7bafd22e8c6f283e3938ec52c5f8e4a1174501 100644 (file)
@@ -3,6 +3,7 @@
 #endif
 
 #include "math_gridinset.h"
+#include "math_mathmlstream.h"
 #include "math_streamstr.h"
 #include "lyxfont.h"
 #include "Painter.h"
index f4e9ad4f926904dd0f4a9f48977dfa6ab9b70d30..03bc1b2ccb702ef7dbc80472f8eca1c42c42021f 100644 (file)
@@ -1,4 +1,5 @@
 #include <config.h>
+#include <algorithm>
 
 #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 (file)
index 0000000..5886fb6
--- /dev/null
@@ -0,0 +1,13 @@
+#include <config.h>
+#include <algorithm>
+
+#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;
+}
index bd4d4ef66d6db9cb8ffd5c781cd7c98ff4646201..2d54ecbe975c9d87b93314b80ad78305b2fb4f66 100644 (file)
@@ -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