#include "math_mathmlstream.h"
#include "math_inset.h"
#include "math_extern.h"
+#include "debug.h"
#include "support/lyxalgo.h"
#include "support/LOstream.h"
{}
+WriteStream::~WriteStream()
+{
+ if (pendingspace_)
+ os_ << ' ';
+}
+
+
void WriteStream::addlines(unsigned int n)
{
line_ += n;
}
+void WriteStream::pendingSpace(bool how)
+{
+ if (how)
+ os_ << ' ';
+ pendingspace_ = how;
+}
+
+
WriteStream & operator<<(WriteStream & ws, MathAtom const & at)
{
at->write(ws);
WriteStream & operator<<(WriteStream & ws, char const * s)
{
+ if (ws.pendingSpace()) {
+ lyxerr << "writing a space in a string\n";
+ ws.os() << ' ';
+ ws.pendingSpace(false);
+ }
ws.os() << s;
ws.addlines(int(lyx::count(s, s + strlen(s), '\n')));
return ws;
WriteStream & operator<<(WriteStream & ws, char c)
{
if (ws.pendingSpace()) {
- if (isalpha(c))
- ws.os() << ' ';
+ //if (isalpha(c))
+ // ws.os() << ' ';
+ if (!isalpha(c)) {
+ lyxerr << "I'd like to suppress writing a space\n";
+ }
+ ws.os() << ' ';
ws.pendingSpace(false);
}
ws.os() << c;
///
explicit WriteStream(std::ostream & os_);
///
+ ~WriteStream();
+ ///
int line() const { return line_; }
///
bool fragile() const { return fragile_; }
///
void addlines(unsigned int);
/// writes space if next thing is isalpha()
- void pendingSpace(bool how) { pendingspace_ = how; }
+ void pendingSpace(bool how);
/// writes space if next thing is isalpha()
bool pendingSpace() const { return pendingspace_; }
private: