Add string << operators for the other streams as well, and removes

c_str() all places where it is not needed anymore.
(I also add config.h to several files that was missing it)
+ added s string constructor to math_symbolinset

I also change some "while(" to "while ("

mmm ... yes ... I add a "zero()" function to LyXLength... an "empty()"
function did not seem appropriate. changed a couple of places that
checked on length.value() != 0.0.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3149 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-12-05 08:04:20 +00:00
parent e1eb45f5d3
commit 33a28bdc9c
60 changed files with 345 additions and 203 deletions

View File

@ -1,3 +1,25 @@
2001-12-05 Lars Gullik Bjønnes <larsbj@birdstep.com>
* BufferView_pimpl:
* CutAndPaste.C:
* DepTable.C:
* buffer.C:
* chset.C:
* lastfiles.C:
* lyxlex.C:
* lyxlex_pimpl.C:
* lyxserver.C:
* screen.C:
* tabular-old.C:
* tabular.C:
* text.C:
* trans_mgr.C:
* vc-backend.C: change "while(" to "while ("
* lyxlength.[Ch]: add zero function to check if length is zero or
not
* lyxgluelength.C: use it
2001-12-05 Allan Rae <rae@lyx.org> 2001-12-05 Allan Rae <rae@lyx.org>
* lyxlength.C: Attempted a fix for the abs(int) header selection. * lyxlength.C: Attempted a fix for the abs(int) header selection.

View File

@ -1,3 +1,8 @@
2001-12-05 Lars Gullik Bjønnes <larsbj@birdstep.com>
* FormCitation.C:
* GUIRunTime.C: change "while(" to "while ("
2001-09-27 Angus Leeming <a.leeming@ic.ac.uk> 2001-09-27 Angus Leeming <a.leeming@ic.ac.uk>
* Dialogs.C: remove splash dialog code. * Dialogs.C: remove splash dialog code.

View File

@ -1,3 +1,7 @@
2001-12-05 Lars Gullik Bjønnes <larsbj@birdstep.com>
* qttableview.C: change "while(" to "while ("
2001-12-05 Allan Rae <rae@lyx.org> 2001-12-05 Allan Rae <rae@lyx.org>
* QParagraph.C (apply): * QParagraph.C (apply):

View File

@ -1,5 +1,5 @@
/********************************************************************** /**********************************************************************
** $Id: qttableview.C,v 1.1 2001/12/01 02:24:27 levon Exp $ ** $Id: qttableview.C,v 1.2 2001/12/05 08:04:18 larsbj Exp $
** **
** Implementation of QtTableView class ** Implementation of QtTableView class
** **
@ -1306,7 +1306,8 @@ void QtTableView::paintEvent( QPaintEvent *e )
int firstRow = findRow( updateR.y() ); int firstRow = findRow( updateR.y() );
int firstCol = findCol( updateR.x() ); int firstCol = findCol( updateR.x() );
int xStart, yStart; int xStart;
int yStart;
if ( !colXPos( firstCol, &xStart ) || !rowYPos( firstRow, &yStart ) ) { if ( !colXPos( firstCol, &xStart ) || !rowYPos( firstRow, &yStart ) ) {
paint.eraseRect( updateR ); // erase area outside cells but in view paint.eraseRect( updateR ); // erase area outside cells but in view
return; return;

View File

@ -1,3 +1,8 @@
2001-12-05 Lars Gullik Bjønnes <larsbj@birdstep.com>
* FormFiledialog.C:
* xforms_helpers.C: change "while(" to "while ("
2001-12-05 Allan Rae <rae@lyx.org> 2001-12-05 Allan Rae <rae@lyx.org>
* FormParagraph.C (apply): One other LyXText fix. * FormParagraph.C (apply): One other LyXText fix.

View File

@ -75,7 +75,7 @@ void FormMinipage::apply()
void FormMinipage::update() void FormMinipage::update()
{ {
LyXLength len(controller().params().width.c_str()); LyXLength len(controller().params().width);
fl_set_input(dialog_->input_width, tostr(len.value()).c_str()); fl_set_input(dialog_->input_width, tostr(len.value()).c_str());
fl_set_choice(dialog_->choice_width_units, len.unit() + 1); fl_set_choice(dialog_->choice_width_units, len.unit() + 1);

View File

@ -1,3 +1,9 @@
2001-12-05 Lars Gullik Bjønnes <larsbj@birdstep.com>
* insetbib.C:
* insettabular.C:
* insettext.C: change "while(" to "while ("
2001-12-04 Juergen Vigna <jug@sad.it> 2001-12-04 Juergen Vigna <jug@sad.it>
* insetert.C (edit): handle Inlined status. * insetert.C (edit): handle Inlined status.

View File

@ -15,9 +15,11 @@
#endif #endif
#include "lyxgluelength.h" #include "lyxgluelength.h"
#include "lengthcommon.h"
#include "Lsstream.h" #include "Lsstream.h"
#if 0
namespace { namespace {
// this is now here and in lyxlenght.h // this is now here and in lyxlenght.h
@ -30,7 +32,7 @@ char const * unit_name[num_units] = { "sp", "pt", "bp", "dd",
"%", "c%", "p%", "l%" }; "%", "c%", "p%", "l%" };
} }
#endif
LyXGlueLength::LyXGlueLength(LyXLength const & len) LyXGlueLength::LyXGlueLength(LyXLength const & len)
: len_(len) : len_(len)
@ -53,8 +55,8 @@ string const LyXGlueLength::asString() const
{ {
ostringstream buffer; ostringstream buffer;
if (plus_.value() != 0.0) if (!plus_.zero())
if (minus_.value() != 0.0) if (!minus_.zero())
if (len_.unit() == plus_.unit() && len_.unit() == minus_.unit()) if (len_.unit() == plus_.unit() && len_.unit() == minus_.unit())
if (plus_.value() == minus_.value()) if (plus_.value() == minus_.value())
buffer << len_.value() << "+-" buffer << len_.value() << "+-"
@ -87,7 +89,7 @@ string const LyXGlueLength::asString() const
<< unit_name[plus_.unit()]; << unit_name[plus_.unit()];
else else
if (minus_.value() != 0.0) if (!minus_.zero())
if (len_.unit() == minus_.unit()) if (len_.unit() == minus_.unit())
buffer << len_.value() << '-' << minus_.value() buffer << len_.value() << '-' << minus_.value()
<< unit_name[len_.unit()]; << unit_name[len_.unit()];
@ -107,8 +109,8 @@ string const LyXGlueLength::asLatexString() const
{ {
ostringstream buffer; ostringstream buffer;
if (plus_.value() != 0.0) if (!plus_.zero())
if (minus_.value() != 0.0) if (!minus_.zero())
buffer << len_.value() << unit_name[len_.unit()] buffer << len_.value() << unit_name[len_.unit()]
<< " plus " << " plus "
<< plus_.value() << unit_name[plus_.unit()] << plus_.value() << unit_name[plus_.unit()]
@ -119,7 +121,7 @@ string const LyXGlueLength::asLatexString() const
<< " plus " << " plus "
<< plus_.value() << unit_name[plus_.unit()]; << plus_.value() << unit_name[plus_.unit()];
else else
if (minus_.value() != 0.0) if (!minus_.zero())
buffer << len_.value() << unit_name[len_.unit()] buffer << len_.value() << unit_name[len_.unit()]
<< " minus " << " minus "
<< minus_.value() << unit_name[minus_.unit()]; << minus_.value() << unit_name[minus_.unit()];

View File

@ -15,15 +15,13 @@
#endif #endif
#include "lyxlength.h" #include "lyxlength.h"
#include "lengthcommon.h"
#include "Lsstream.h" #include "Lsstream.h"
#if defined(__GNUG__) && __GNUC__ == 2 && __GNUC_MINOR__ >= 95
#include <cstdlib> #include <cstdlib>
#else
#include <cmath>
#endif
#if 0
namespace { namespace {
// this is now here and in lyxgluelength.C // this is now here and in lyxgluelength.C
@ -45,6 +43,7 @@ LyXLength::UNIT unitFromString(string const & data)
} }
} }
#endif
LyXLength::LyXLength() LyXLength::LyXLength()
@ -126,6 +125,12 @@ void LyXLength::unit(LyXLength::UNIT u)
} }
bool LyXLength::zero() const
{
return val_ == 0.0;
}
bool operator==(LyXLength const & l1, LyXLength const & l2) bool operator==(LyXLength const & l1, LyXLength const & l2)
{ {
return l1.value() == l2.value() && l1.unit() == l2.unit(); return l1.value() == l2.value() && l1.unit() == l2.unit();

View File

@ -77,10 +77,8 @@ public:
void value(double); void value(double);
/// ///
void unit(LyXLength::UNIT unit); void unit(LyXLength::UNIT unit);
///
/// real length in SP bool zero() const;
//void lenght();
/// conversion /// conversion
string const asString() const; string const asString() const;
/// ///

View File

@ -1,3 +1,32 @@
2001-12-05 Lars Gullik Bjønnes <larsbj@birdstep.com>
* math_arrayinset.C:
* math_boxinset.C:
* math_decorationinset.C:
* math_deliminset.C:
* math_dotsinset.C:
* math_exfuncinset.C:
* math_exintinset.C:
* math_funcinset.C:
* math_funcliminset.C:
* math_hullinset.C:
* math_kerninset.C:
* math_limopinset.C:
* math_sizeinset.C:
* math_stringinset.C:
* math_symbolinset.C:
* math_unknowninset.C: include math_streamstr.h and remove
unneeded c_str()
* math_symbolinset.[Ch]: add constructor taking string
* math_mathmlstream.C: move includes around
* math_streamstr.[Ch]: add operator<<(Stream, string) for
NormalStream, MapleStream, MathMLStream and OctaveStream
* math_gridinset.C: user LyXLength::zero
2001-11-19 Angus Leeming <a.leeming@ic.ac.uk> 2001-11-19 Angus Leeming <a.leeming@ic.ac.uk>
* formula.C: * formula.C:

View File

@ -1,14 +1,17 @@
#include <config.h>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
#include <iterator>
#include "math_arrayinset.h" #include "math_arrayinset.h"
#include "math_parser.h" #include "math_parser.h"
#include "math_mathmlstream.h" #include "math_mathmlstream.h"
#include "math_streamstr.h"
#include "Lsstream.h" #include "Lsstream.h"
#include <iterator>
using std::vector; using std::vector;
using std::istringstream; using std::istringstream;
using std::getline; using std::getline;
@ -77,7 +80,7 @@ void MathArrayInset::write(WriteStream & os) const
if (v_align_ == 't' || v_align_ == 'b') if (v_align_ == 't' || v_align_ == 'b')
os << '[' << char(v_align_) << ']'; os << '[' << char(v_align_) << ']';
os << '{' << halign().c_str() << "}\n"; os << '{' << halign() << "}\n";
MathGridInset::write(os); MathGridInset::write(os);

View File

@ -1,3 +1,5 @@
#include <config.h>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
@ -10,7 +12,7 @@
#include "math_cursor.h" #include "math_cursor.h"
#include "insets/insettext.h" #include "insets/insettext.h"
#include "math_mathmlstream.h" #include "math_mathmlstream.h"
#include "math_streamstr.h"
MathBoxInset::MathBoxInset(string const & name) MathBoxInset::MathBoxInset(string const & name)
: MathDimInset(), name_(name), text_(new InsetText), buffer_(0) : MathDimInset(), name_(name), text_(new InsetText), buffer_(0)
@ -47,7 +49,7 @@ UpdatableInset * MathBoxInset::asHyperActiveInset() const
void MathBoxInset::write(WriteStream & os) const void MathBoxInset::write(WriteStream & os) const
{ {
os << "\\" << name_.c_str() << "{" << cell(0) << "}"; os << "\\" << name_ << "{" << cell(0) << "}";
} }

View File

@ -1,3 +1,5 @@
#include <config.h>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
@ -6,6 +8,7 @@
#include "math_support.h" #include "math_support.h"
#include "math_parser.h" #include "math_parser.h"
#include "math_mathmlstream.h" #include "math_mathmlstream.h"
#include "math_streamstr.h"
MathDecorationInset::MathDecorationInset(string const & name) MathDecorationInset::MathDecorationInset(string const & name)
@ -95,11 +98,11 @@ void MathDecorationInset::write(WriteStream & os) const
{ {
if (os.fragile() && protect()) if (os.fragile() && protect())
os << "\\protect"; os << "\\protect";
os << '\\' << name_.c_str() << '{' << cell(0) << '}'; os << '\\' << name_ << '{' << cell(0) << '}';
} }
void MathDecorationInset::normalize(NormalStream & os) const void MathDecorationInset::normalize(NormalStream & os) const
{ {
os << "[deco " << name_.c_str() << ' ' << cell(0) << ']'; os << "[deco " << name_ << ' ' << cell(0) << ']';
} }

View File

@ -8,6 +8,7 @@
#include "math_parser.h" #include "math_parser.h"
#include "math_support.h" #include "math_support.h"
#include "math_mathmlstream.h" #include "math_mathmlstream.h"
#include "math_streamstr.h"
#include "math_extern.h" #include "math_extern.h"
@ -44,15 +45,15 @@ string MathDelimInset::latexName(string const & name)
void MathDelimInset::write(WriteStream & os) const void MathDelimInset::write(WriteStream & os) const
{ {
os << "\\left" << latexName(left_).c_str() << cell(0) os << "\\left" << latexName(left_) << cell(0)
<< "\\right" << latexName(right_).c_str(); << "\\right" << latexName(right_);
} }
void MathDelimInset::normalize(NormalStream & os) const void MathDelimInset::normalize(NormalStream & os) const
{ {
os << "[delim " << latexName(left_).c_str() << ' ' os << "[delim " << latexName(left_) << ' '
<< latexName(right_).c_str() << ' ' << cell(0) << ']'; << latexName(right_) << ' ' << cell(0) << ']';
} }
@ -121,14 +122,14 @@ void MathDelimInset::maplize(MapleStream & os) const
os << "abs(" << cell(0) << ")"; os << "abs(" << cell(0) << ")";
} }
else else
os << left_.c_str() << cell(0) << right_.c_str(); os << left_ << cell(0) << right_;
} }
void MathDelimInset::mathmlize(MathMLStream & os) const void MathDelimInset::mathmlize(MathMLStream & os) const
{ {
os << "<fenced open=\"" << left_.c_str() << "\" close=\"" os << "<fenced open=\"" << left_ << "\" close=\""
<< right_.c_str() << "\">" << cell(0) << "</fenced>"; << right_ << "\">" << cell(0) << "</fenced>";
} }
@ -137,5 +138,5 @@ void MathDelimInset::octavize(OctaveStream & os) const
if (isAbs()) if (isAbs())
os << "det(" << cell(0) << ")"; os << "det(" << cell(0) << ")";
else else
os << left_.c_str() << cell(0) << right_.c_str(); os << left_ << cell(0) << right_;
} }

View File

@ -1,9 +1,12 @@
#include <config.h>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
#include "math_dotsinset.h" #include "math_dotsinset.h"
#include "math_mathmlstream.h" #include "math_mathmlstream.h"
#include "math_streamstr.h"
#include "math_support.h" #include "math_support.h"
@ -44,11 +47,11 @@ void MathDotsInset::metrics(MathMetricsInfo const & mi) const
void MathDotsInset::write(WriteStream & os) const void MathDotsInset::write(WriteStream & os) const
{ {
os << '\\' << name_.c_str() << ' '; os << '\\' << name_ << ' ';
} }
void MathDotsInset::normalize(NormalStream & os) const void MathDotsInset::normalize(NormalStream & os) const
{ {
os << "[" << name_.c_str() << "] "; os << "[" << name_ << "] ";
} }

View File

@ -1,7 +1,9 @@
#include <config.h>
#include "math_exfuncinset.h" #include "math_exfuncinset.h"
#include "math_support.h" #include "math_support.h"
#include "math_mathmlstream.h" #include "math_mathmlstream.h"
#include "math_streamstr.h"
using std::ostream; using std::ostream;
@ -32,13 +34,13 @@ void MathExFuncInset::draw(Painter & pain, int x, int y) const
void MathExFuncInset::normalize(NormalStream & os) const void MathExFuncInset::normalize(NormalStream & os) const
{ {
os << '[' << name_.c_str() << ' ' << cell(0) << ']'; os << '[' << name_ << ' ' << cell(0) << ']';
} }
void MathExFuncInset::maplize(MapleStream & os) const void MathExFuncInset::maplize(MapleStream & os) const
{ {
os << name_.c_str() << '(' << cell(0) << ')'; os << name_ << '(' << cell(0) << ')';
} }
@ -50,13 +52,13 @@ void MathExFuncInset::mathmlize(MathMLStream & os) const
void MathExFuncInset::octavize(OctaveStream & os) const void MathExFuncInset::octavize(OctaveStream & os) const
{ {
os << name_.c_str() << '(' << cell(0) << ')'; os << name_ << '(' << cell(0) << ')';
} }
void MathExFuncInset::write(WriteStream & os) const void MathExFuncInset::write(WriteStream & os) const
{ {
os << '\\' << name_.c_str() << '{' << cell(0) << '}'; os << '\\' << name_ << '{' << cell(0) << '}';
} }

View File

@ -1,9 +1,14 @@
#include <config.h>
#include "math_exintinset.h" #include "math_exintinset.h"
#include "math_support.h" #include "math_support.h"
#include "math_mathmlstream.h" #include "math_mathmlstream.h"
#include "math_streamstr.h"
#include "math_symbolinset.h" #include "math_symbolinset.h"
#include "debug.h" #include "debug.h"
using std::endl;
MathExIntInset::MathExIntInset(string const & name) MathExIntInset::MathExIntInset(string const & name)
: MathNestInset(4), symbol_(name) : MathNestInset(4), symbol_(name)
@ -37,26 +42,26 @@ bool MathExIntInset::hasScripts() const
void MathExIntInset::normalize(NormalStream & os) const void MathExIntInset::normalize(NormalStream & os) const
{ {
os << '[' << symbol_.c_str() << ' ' << cell(0) << ' ' << cell(1) << ' ' os << '[' << symbol_ << ' ' << cell(0) << ' ' << cell(1) << ' '
<< cell(2) << ' ' << cell(3) << ']'; << cell(2) << ' ' << cell(3) << ']';
} }
void MathExIntInset::metrics(MathMetricsInfo const &) const void MathExIntInset::metrics(MathMetricsInfo const &) const
{ {
lyxerr << "should not happen\n"; lyxerr << "should not happen" << endl;
} }
void MathExIntInset::draw(Painter &, int, int) const void MathExIntInset::draw(Painter &, int, int) const
{ {
lyxerr << "should not happen\n"; lyxerr << "should not happen" << endl;
} }
void MathExIntInset::maplize(MapleStream & os) const void MathExIntInset::maplize(MapleStream & os) const
{ {
os << symbol_.c_str() << '('; os << symbol_ << '(';
if (cell(0).size()) if (cell(0).size())
os << cell(0); os << cell(0);
else else
@ -70,7 +75,7 @@ void MathExIntInset::maplize(MapleStream & os) const
void MathExIntInset::mathmlize(MathMLStream & os) const void MathExIntInset::mathmlize(MathMLStream & os) const
{ {
MathSymbolInset * sym = new MathSymbolInset(symbol_.c_str()); MathSymbolInset * sym = new MathSymbolInset(symbol_);
//if (hasScripts()) //if (hasScripts())
// mathmlize(sym, os); // mathmlize(sym, os);
//else //else
@ -84,6 +89,6 @@ void MathExIntInset::mathmlize(MathMLStream & os) const
void MathExIntInset::write(WriteStream &) const void MathExIntInset::write(WriteStream &) const
{ {
lyxerr << "should not happen\n"; lyxerr << "should not happen" << endl;
} }

View File

@ -1,3 +1,5 @@
#include <config.h>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
@ -7,7 +9,7 @@
#include "Painter.h" #include "Painter.h"
#include "math_support.h" #include "math_support.h"
#include "math_mathmlstream.h" #include "math_mathmlstream.h"
#include "math_streamstr.h"
extern LyXFont WhichFont(short type, int size); extern LyXFont WhichFont(short type, int size);
@ -58,29 +60,29 @@ bool MathFuncInset::match(MathInset * p) const
void MathFuncInset::maplize(MapleStream & os) const void MathFuncInset::maplize(MapleStream & os) const
{ {
os << ' ' << name_.c_str(); os << ' ' << name_;
} }
void MathFuncInset::mathmlize(MathMLStream & os) const void MathFuncInset::mathmlize(MathMLStream & os) const
{ {
os << MTag("mi") << name_.c_str() << ETag("mi"); os << MTag("mi") << name_ << ETag("mi");
} }
void MathFuncInset::octavize(OctaveStream & os) const void MathFuncInset::octavize(OctaveStream & os) const
{ {
os << ' ' << name_.c_str(); os << ' ' << name_;
} }
void MathFuncInset::normalize(NormalStream & os) const void MathFuncInset::normalize(NormalStream & os) const
{ {
os << "[func " << name_.c_str() << ']'; os << "[func " << name_ << ']';
} }
void MathFuncInset::write(WriteStream & os) const void MathFuncInset::write(WriteStream & os) const
{ {
os << "\\" << name_.c_str() << ' '; os << "\\" << name_ << ' ';
} }

View File

@ -1,5 +1,8 @@
#include <config.h>
#include "math_funcliminset.h" #include "math_funcliminset.h"
#include "math_mathmlstream.h" #include "math_mathmlstream.h"
#include "math_streamstr.h"
#include "math_support.h" #include "math_support.h"
@ -22,13 +25,13 @@ bool MathFuncLimInset::isScriptable() const
void MathFuncLimInset::write(WriteStream & os) const void MathFuncLimInset::write(WriteStream & os) const
{ {
os << '\\' << name_.c_str() << ' '; os << '\\' << name_ << ' ';
} }
void MathFuncLimInset::normalize(NormalStream & os) const void MathFuncLimInset::normalize(NormalStream & os) const
{ {
os << "[funclim " << name_.c_str() << ']'; os << "[funclim " << name_ << ']';
} }

View File

@ -380,7 +380,7 @@ string MathGridInset::eolString(row_type row) const
{ {
string eol; string eol;
if (rowinfo_[row].crskip_.value() != 0) if (!rowinfo_[row].crskip_.zero())
eol += "[" + rowinfo_[row].crskip_.asLatexString() + "]"; eol += "[" + rowinfo_[row].crskip_.asLatexString() + "]";
// make sure an upcoming '[' does not break anything // make sure an upcoming '[' does not break anything

View File

@ -1,16 +1,20 @@
#include <config.h>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
#include <vector>
#include "math_hullinset.h" #include "math_hullinset.h"
#include "math_support.h" #include "math_support.h"
#include "debug.h" #include "debug.h"
#include "Painter.h" #include "Painter.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "math_mathmlstream.h" #include "math_mathmlstream.h"
#include "math_streamstr.h"
#include <vector>
using std::endl;
namespace { namespace {
@ -608,7 +612,8 @@ void MathHullInset::mutate(MathInsetTypes newtype)
default: default:
lyxerr << "mutation from '" << getType() lyxerr << "mutation from '" << getType()
<< "' to '" << newtype << "' not implemented\n"; << "' to '" << newtype << "' not implemented"
<< endl;
break; break;
} }
break; break;
@ -620,7 +625,8 @@ void MathHullInset::mutate(MathInsetTypes newtype)
break; break;
default: default:
lyxerr << "mutation from '" << getType() lyxerr << "mutation from '" << getType()
<< "' to '" << newtype << "' not implemented\n"; << "' to '" << newtype << "' not implemented"
<< endl;
break; break;
} }
@ -631,13 +637,16 @@ void MathHullInset::mutate(MathInsetTypes newtype)
break; break;
default: default:
lyxerr << "mutation from '" << getType() lyxerr << "mutation from '" << getType()
<< "' to '" << newtype << "' not implemented\n"; << "' to '" << newtype << "' not implemented"
<< endl;
break; break;
} }
default: default:
lyxerr << "mutation from '" << getType() lyxerr << "mutation from '" << getType()
<< "' to '" << newtype << "' not implemented\n"; << "' to '" << newtype << "' not implemented"
<< endl;
break;
} }
} }
@ -650,14 +659,14 @@ void MathHullInset::write(WriteStream & os) const
for (row_type row = 0; row < nrows(); ++row) { for (row_type row = 0; row < nrows(); ++row) {
for (col_type col = 0; col < ncols(); ++col) for (col_type col = 0; col < ncols(); ++col)
os << cell(index(row, col)) << eocString(col).c_str(); os << cell(index(row, col)) << eocString(col);
if (n) { if (n) {
if (!label_[row].empty()) if (!label_[row].empty())
os << "\\label{" << label_[row].c_str() << "}"; os << "\\label{" << label_[row] << "}";
if (nonum_[row]) if (nonum_[row])
os << "\\nonumber "; os << "\\nonumber ";
} }
os << eolString(row).c_str(); os << eolString(row);
} }
footer_write(os); footer_write(os);
@ -666,7 +675,7 @@ void MathHullInset::write(WriteStream & os) const
void MathHullInset::normalize(NormalStream & os) const void MathHullInset::normalize(NormalStream & os) const
{ {
os << "[formula " << normalName(getType()).c_str() << " "; os << "[formula " << normalName(getType()) << " ";
MathGridInset::normalize(os); MathGridInset::normalize(os);
os << "] "; os << "] ";
} }

View File

@ -1,9 +1,12 @@
#include <config.h>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
#include "math_kerninset.h" #include "math_kerninset.h"
#include "math_mathmlstream.h" #include "math_mathmlstream.h"
#include "math_streamstr.h"
#include "math_support.h" #include "math_support.h"
@ -46,12 +49,12 @@ void MathKernInset::metrics(MathMetricsInfo const &) const
void MathKernInset::write(WriteStream & os) const void MathKernInset::write(WriteStream & os) const
{ {
os << "\\kern" << wid_.asLatexString().c_str() << " "; os << "\\kern" << wid_.asLatexString() << " ";
} }
void MathKernInset::normalize(NormalStream & os) const void MathKernInset::normalize(NormalStream & os) const
{ {
os << "[kern " << wid_.asLatexString().c_str() << "]"; os << "[kern " << wid_.asLatexString() << "]";
} }

View File

@ -45,10 +45,10 @@ void MathLimitOpInset::draw(Painter &, int, int) const
void MathLimitOpInset::maplize(MapleStream &) const void MathLimitOpInset::maplize(MapleStream &) const
{ {
//os << name_.c_str() << '(' << cell(0) << ')'; //os << name_ << '(' << cell(0) << ')';
} }
void MathLimitOpInset::mathmlize(MathMLStream &) const void MathLimitOpInset::mathmlize(MathMLStream &) const
{ {
//os << name_.c_str() << '(' << cell(0) << ')'; //os << name_ << '(' << cell(0) << ')';
} }

View File

@ -1,11 +1,12 @@
#include <config.h> #include <config.h>
#include <algorithm>
#include "math_mathmlstream.h" #include "math_mathmlstream.h"
#include "math_inset.h" #include "math_inset.h"
#include "math_extern.h" #include "math_extern.h"
#include "debug.h" #include "debug.h"
#include <algorithm>
MathMLStream::MathMLStream(std::ostream & os) MathMLStream::MathMLStream(std::ostream & os)
: os_(os), tab_(0), line_(0), lastchar_(0) : os_(os), tab_(0), line_(0), lastchar_(0)

View File

@ -1,3 +1,5 @@
#include <config.h>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
@ -5,6 +7,7 @@
#include "math_sizeinset.h" #include "math_sizeinset.h"
#include "math_parser.h" #include "math_parser.h"
#include "math_mathmlstream.h" #include "math_mathmlstream.h"
#include "math_streamstr.h"
MathSizeInset::MathSizeInset(latexkeys const * l) MathSizeInset::MathSizeInset(latexkeys const * l)
@ -37,11 +40,11 @@ void MathSizeInset::metrics(MathMetricsInfo const & mi) const
void MathSizeInset::write(WriteStream & os) const void MathSizeInset::write(WriteStream & os) const
{ {
os << "{\\" << key_->name.c_str() << ' ' << cell(0) << '}'; os << "{\\" << key_->name << ' ' << cell(0) << '}';
} }
void MathSizeInset::normalize(NormalStream & os) const void MathSizeInset::normalize(NormalStream & os) const
{ {
os << "[" << key_->name.c_str() << ' ' << cell(0) << ']'; os << "[" << key_->name << ' ' << cell(0) << ']';
} }

View File

@ -1,8 +1,9 @@
#include <config.h> #include <config.h>
#include <algorithm>
#include "math_mathmlstream.h"
#include "math_streamstr.h" #include "math_streamstr.h"
#include "math_mathmlstream.h"
#include <algorithm>
WriteStream & operator<<(WriteStream & ws, string const & s) WriteStream & operator<<(WriteStream & ws, string const & s)
@ -11,3 +12,31 @@ WriteStream & operator<<(WriteStream & ws, string const & s)
ws.line() += std::count(s.begin(), s.end(), '\n'); ws.line() += std::count(s.begin(), s.end(), '\n');
return ws; return ws;
} }
NormalStream & operator<<(NormalStream & ns, string const & s)
{
ns.os() << s;
return ns;
}
MapleStream & operator<<(MapleStream & ms, string const & s)
{
ms.os() << s;
return ms;
}
MathMLStream & operator<<(MathMLStream & ms, string const & s)
{
ms.os() << s;
return ms;
}
OctaveStream & operator<<(OctaveStream & os, string const & s)
{
os.os() << s;
return os;
}

View File

@ -1,14 +1,22 @@
// -*- C++ -*-
#ifndef MATH_STREAMSTR_H #ifndef MATH_STREAMSTR_H
#define MATH_STREAMSTR_H #define MATH_STREAMSTR_H
#include "LString.h" #include "LString.h"
class WriteStream; class WriteStream;
class NormalStream;
class MapleStream;
class MathMLStream;
class OctaveStream;
// //
// writing strings directly // writing strings directly
// //
WriteStream & operator<<(WriteStream & ws, string const & s); WriteStream & operator<<(WriteStream & ws, string const & s);
NormalStream & operator<<(NormalStream & ns, string const & s);
MapleStream & operator<<(MapleStream & ms, string const & s);
MathMLStream & operator<<(MathMLStream & ms, string const & s);
OctaveStream & operator<<(OctaveStream & os, string const & s);
#endif #endif

View File

@ -1,17 +1,20 @@
#include <config.h>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
#include <cctype>
#include "math_stringinset.h" #include "math_stringinset.h"
#include "math_mathmlstream.h" #include "math_mathmlstream.h"
#include "math_streamstr.h"
#include "LColor.h" #include "LColor.h"
#include "Painter.h" #include "Painter.h"
#include "math_support.h" #include "math_support.h"
#include "math_parser.h" #include "math_parser.h"
#include "debug.h" #include "debug.h"
#include <cctype>
MathStringInset::MathStringInset() MathStringInset::MathStringInset()
: str_(), code_(LM_TC_MIN) : str_(), code_(LM_TC_MIN)
@ -61,14 +64,14 @@ void MathStringInset::draw(Painter & pain, int x, int y) const
void MathStringInset::normalize(NormalStream & os) const void MathStringInset::normalize(NormalStream & os) const
{ {
os << "[string " << str_.c_str() << ' ' << "mathalpha" << "]"; os << "[string " << str_ << ' ' << "mathalpha" << "]";
} }
void MathStringInset::maplize(MapleStream & os) const void MathStringInset::maplize(MapleStream & os) const
{ {
if (code_ != LM_TC_VAR || str_.size() <= 1) { if (code_ != LM_TC_VAR || str_.size() <= 1) {
os << ' ' << str_.c_str() << ' '; os << ' ' << str_ << ' ';
return; return;
} }
@ -82,7 +85,7 @@ void MathStringInset::maplize(MapleStream & os) const
void MathStringInset::octavize(OctaveStream & os) const void MathStringInset::octavize(OctaveStream & os) const
{ {
if (code_ != LM_TC_VAR || str_.size() <= 1) { if (code_ != LM_TC_VAR || str_.size() <= 1) {
os << ' ' << str_.c_str() << ' '; os << ' ' << str_ << ' ';
return; return;
} }
@ -96,20 +99,20 @@ void MathStringInset::octavize(OctaveStream & os) const
void MathStringInset::mathmlize(MathMLStream & os) const void MathStringInset::mathmlize(MathMLStream & os) const
{ {
if (code_ == LM_TC_VAR) if (code_ == LM_TC_VAR)
os << "<mi> " << str_.c_str() << " </mi>"; os << "<mi> " << str_ << " </mi>";
else if (code_ == LM_TC_CONST) else if (code_ == LM_TC_CONST)
os << "<mn> " << str_.c_str() << " </mn>"; os << "<mn> " << str_ << " </mn>";
else if (code_ == LM_TC_RM || code_ == LM_TC_TEXTRM) else if (code_ == LM_TC_RM || code_ == LM_TC_TEXTRM)
os << "<mtext> " << str_.c_str() << " </mtext>"; os << "<mtext> " << str_ << " </mtext>";
else else
os << str_.c_str(); os << str_;
} }
void MathStringInset::write(WriteStream & os) const void MathStringInset::write(WriteStream & os) const
{ {
if (math_font_name(code_)) if (math_font_name(code_))
os << '\\' << math_font_name(code_) << '{' << str_.c_str() << '}'; os << '\\' << math_font_name(code_) << '{' << str_ << '}';
else else
os << str_.c_str(); os << str_;
} }

View File

@ -1,5 +1,8 @@
#include <config.h>
#include "math_symbolinset.h" #include "math_symbolinset.h"
#include "math_mathmlstream.h" #include "math_mathmlstream.h"
#include "math_streamstr.h"
#include "math_support.h" #include "math_support.h"
#include "math_parser.h" #include "math_parser.h"
#include "debug.h" #include "debug.h"
@ -15,6 +18,11 @@ MathSymbolInset::MathSymbolInset(const char * name)
{} {}
MathSymbolInset::MathSymbolInset(string const & name)
: sym_(in_word_set(name.c_str())), h_(0)
{}
MathInset * MathSymbolInset::clone() const MathInset * MathSymbolInset::clone() const
{ {
@ -114,7 +122,7 @@ bool MathSymbolInset::takesLimits() const
void MathSymbolInset::normalize(NormalStream & os) const void MathSymbolInset::normalize(NormalStream & os) const
{ {
os << "[symbol " << name().c_str() << "]"; os << "[symbol " << name() << "]";
} }
@ -123,7 +131,7 @@ void MathSymbolInset::maplize(MapleStream & os) const
if (name() == "cdot") if (name() == "cdot")
os << '*'; os << '*';
else else
os << name().c_str(); os << name();
} }
@ -147,9 +155,9 @@ void MathSymbolInset::mathmlize(MathMLStream & os) const
char const * type = MathMLtype(sym_->type); char const * type = MathMLtype(sym_->type);
os << '<' << type << "> "; os << '<' << type << "> ";
if (sym_->xmlname == "x") // unknown so far if (sym_->xmlname == "x") // unknown so far
os << name().c_str(); os << name();
else else
os << sym_->xmlname.c_str(); os << sym_->xmlname;
os << " </" << type << '>'; os << " </" << type << '>';
} }
@ -159,13 +167,13 @@ void MathSymbolInset::octavize(OctaveStream & os) const
if (name() == "cdot") if (name() == "cdot")
os << '*'; os << '*';
else else
os << name().c_str(); os << name();
} }
void MathSymbolInset::write(WriteStream & os) const void MathSymbolInset::write(WriteStream & os) const
{ {
os << '\\' << name().c_str() << ' '; os << '\\' << name() << ' ';
} }

View File

@ -16,6 +16,8 @@ public:
/// ///
explicit MathSymbolInset(char const *); explicit MathSymbolInset(char const *);
/// ///
explicit MathSymbolInset(string const &);
///
MathInset * clone() const; MathInset * clone() const;
/// ///
void metrics(MathMetricsInfo const & st) const; void metrics(MathMetricsInfo const & st) const;

View File

@ -1,3 +1,5 @@
#include <config.h>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
@ -7,7 +9,7 @@
#include "Painter.h" #include "Painter.h"
#include "math_support.h" #include "math_support.h"
#include "math_mathmlstream.h" #include "math_mathmlstream.h"
#include "math_streamstr.h"
extern LyXFont WhichFont(short type, int size); extern LyXFont WhichFont(short type, int size);
@ -38,13 +40,13 @@ void MathUnknownInset::setName(string const & n)
void MathUnknownInset::write(WriteStream & os) const void MathUnknownInset::write(WriteStream & os) const
{ {
os << "\\" << name_.c_str() << ' '; os << "\\" << name_ << ' ';
} }
void MathUnknownInset::normalize(NormalStream & os) const void MathUnknownInset::normalize(NormalStream & os) const
{ {
os << "[func " << name_.c_str() << ']'; os << "[func " << name_ << ']';
} }
@ -63,17 +65,17 @@ void MathUnknownInset::draw(Painter & pain, int x, int y) const
void MathUnknownInset::maplize(MapleStream & os) const void MathUnknownInset::maplize(MapleStream & os) const
{ {
os << name_.c_str(); os << name_;
} }
void MathUnknownInset::mathmlize(MathMLStream & os) const void MathUnknownInset::mathmlize(MathMLStream & os) const
{ {
os << MTag("mi") << name_.c_str() << ETag("mi"); os << MTag("mi") << name_ << ETag("mi");
} }
void MathUnknownInset::octavize(OctaveStream & os) const void MathUnknownInset::octavize(OctaveStream & os) const
{ {
os << name_.c_str(); os << name_;
} }

View File

@ -1,3 +1,9 @@
2001-12-05 Lars Gullik Bjønnes <larsbj@birdstep.com>
* filetools.C:
* lstrings.C:
* lyxstring.C: change "while(" to "while ("
2001-12-03 Ben Stanley <bds02@uow.edu.au> 2001-12-03 Ben Stanley <bds02@uow.edu.au>
* lyxsum.C: Added mmap version of CRC and made it selected * lyxsum.C: Added mmap version of CRC and made it selected

View File

@ -29,39 +29,6 @@
namespace { namespace {
#if 0
/* length units
*/
int const num_units = LyXLength::UNIT_NONE;
// I am not sure if "mu" should be possible to select (Lgb)
char const * unit_name[num_units] = { "sp", "pt", "bp", "dd",
"mm", "pc", "cc", "cm",
"in", "ex", "em", "mu",
"%", "c%", "p%", "l%" };
/* The following static items form a simple scanner for
* length strings, used by isValid[Glue]Length. See comments there.
*/
double number[4] = { 0, 0, 0, 0 };
LyXLength::UNIT unit[4] = { LyXLength::UNIT_NONE,
LyXLength::UNIT_NONE,
LyXLength::UNIT_NONE,
LyXLength::UNIT_NONE };
int number_index;
int unit_index;
LyXLength::UNIT unitFromString(string const & data)
{
int i = 0;
while (i < num_units && data != unit_name[i])
++i;
return static_cast<LyXLength::UNIT>(i);
}
#endif
double number[4] = { 0, 0, 0, 0 }; double number[4] = { 0, 0, 0, 0 };
LyXLength::UNIT unit[4] = { LyXLength::UNIT_NONE, LyXLength::UNIT unit[4] = { LyXLength::UNIT_NONE,
LyXLength::UNIT_NONE, LyXLength::UNIT_NONE,