From f5f9c46c35735a5a9d3f186ec5509424e2cffce6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Mon, 24 Sep 2001 13:38:52 +0000 Subject: [PATCH] Use dummy Buffer * parameters to make Jean-Marc's compiler happy git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2793 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/formula.C | 18 ++++++------- src/mathed/formula.h | 12 ++++----- src/mathed/formulabase.C | 56 +++++++-------------------------------- src/mathed/formulabase.h | 30 --------------------- src/mathed/formulamacro.C | 16 +++++------ src/mathed/formulamacro.h | 16 +++++------ src/mathed/math_cursor.C | 2 +- 7 files changed, 41 insertions(+), 109 deletions(-) diff --git a/src/mathed/formula.C b/src/mathed/formula.C index d6c7bb40c6..ca63b9210f 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -88,40 +88,40 @@ Inset * InsetFormula::clone(Buffer const &, bool) const } -void InsetFormula::write(ostream & os) const +void InsetFormula::write(Buffer const * buf, ostream & os) const { os << "Formula "; - latex(os, false, false); + latex(buf, os, false, false); } -int InsetFormula::latex(ostream & os, bool fragile, bool) const +int InsetFormula::latex(Buffer const *, ostream & os, bool fragile, bool) const { par_->write(os, fragile); return 1; } -int InsetFormula::ascii(ostream & os, int) const +int InsetFormula::ascii(Buffer const *, ostream & os, int) const { par_->write(os, false); return 1; } -int InsetFormula::linuxdoc(ostream & os) const +int InsetFormula::linuxdoc(Buffer const * buf, ostream & os) const { - return ascii(os, 0); + return ascii(buf, os, 0); } -int InsetFormula::docbook(ostream & os) const +int InsetFormula::docbook(Buffer const * buf, ostream & os) const { - return ascii(os, 0); + return ascii(buf, os, 0); } -void InsetFormula::read(LyXLex & lex) +void InsetFormula::read(Buffer const *, LyXLex & lex) { par(mathed_parse_normal(lex)); metrics(); diff --git a/src/mathed/formula.h b/src/mathed/formula.h index 294eb87f10..bceefc0f33 100644 --- a/src/mathed/formula.h +++ b/src/mathed/formula.h @@ -53,17 +53,17 @@ public: void metrics() const; /// - void write(std::ostream &) const; + void write(Buffer const *, std::ostream &) const; /// - void read(LyXLex & lex); + void read(Buffer const *, LyXLex & lex); /// - int latex(std::ostream &, bool fragile, bool free_spc) const; + int latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; /// - int ascii(std::ostream &, int linelen) const; + int ascii(Buffer const *, std::ostream &, int linelen) const; /// - int linuxdoc(std::ostream &) const; + int linuxdoc(Buffer const *, std::ostream &) const; /// - int docbook(std::ostream &) const; + int docbook(Buffer const *, std::ostream &) const; /// Inset * clone(Buffer const &, bool same_id = false) const; diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index 72a0916348..a9b75d324d 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -110,44 +110,6 @@ InsetFormulaBase::InsetFormulaBase() } -void InsetFormulaBase::read(Buffer const *, LyXLex & lex) -{ - read(lex); -} - - -void InsetFormulaBase::write(Buffer const *, ostream & os) const -{ - write(os); -} - - -int InsetFormulaBase::latex(Buffer const *, ostream & os, - bool fragile, bool spacing) const -{ - return latex(os, fragile, spacing); -} - - -int InsetFormulaBase::ascii(Buffer const *, ostream & os, int spacing) const -{ - return ascii(os, spacing); -} - - -int InsetFormulaBase::linuxdoc(Buffer const *, ostream & os) const -{ - return linuxdoc(os); -} - - -int InsetFormulaBase::docbook(Buffer const *, ostream & os) const -{ - return docbook(os); -} - - - // Check if uses AMS macros void InsetFormulaBase::validate(LaTeXFeatures &) const {} @@ -726,15 +688,15 @@ void mathDispatchCreation(BufferView * bv, string const & arg, bool display) InsetFormulaBase * f; if (sel.empty()) { - f = new InsetFormula; - if (openNewInset(bv, f)) { - // don't do that also for LFUN_MATH_MODE unless you want end up with - // always changing to mathrm when opening an inlined inset - // -- I really hate "LyXfunc overloading"... - if (display) - f->localDispatch(bv, LFUN_MATH_DISPLAY, string()); - f->localDispatch(bv, LFUN_INSERT_MATH, arg); - } + f = new InsetFormula; + if (openNewInset(bv, f)) { + // don't do that also for LFUN_MATH_MODE unless you want end up with + // always changing to mathrm when opening an inlined inset + // -- I really hate "LyXfunc overloading"... + if (display) + f->localDispatch(bv, LFUN_MATH_DISPLAY, string()); + f->localDispatch(bv, LFUN_INSERT_MATH, arg); + } } else { // create a macro if we see "\\newcommand" somewhere, and an ordinary // formula otherwise diff --git a/src/mathed/formulabase.h b/src/mathed/formulabase.h index f206eece75..022b635253 100644 --- a/src/mathed/formulabase.h +++ b/src/mathed/formulabase.h @@ -42,39 +42,9 @@ public: virtual int width(BufferView *, LyXFont const &) const = 0; /// virtual void draw(BufferView *,LyXFont const &, int, float &, bool) const = 0; - - /// These are just wrappers taking the unused Buffer * dummy parameter - /// - virtual void write(Buffer const *, std::ostream &) const; - /// - virtual void read(Buffer const *, LyXLex & lex); - /// - virtual int latex(Buffer const *, std::ostream &, - bool fragile, bool free_spc) const; - /// - virtual int ascii(Buffer const *, std::ostream &, int linelen) const; - /// - virtual int linuxdoc(Buffer const *, std::ostream &) const; - /// - virtual int docbook(Buffer const *, std::ostream &) const; /// virtual MathInsetTypes getType() const = 0; -protected: - /// the actual functions don't use the Buffer * parameter - /// - virtual void write(std::ostream &) const = 0; - /// - virtual void read(LyXLex & lex) = 0; - /// - virtual int latex(std::ostream &, bool fragile, bool free_spc) const = 0; - /// - virtual int ascii(std::ostream &, int linelen) const = 0; - /// - virtual int linuxdoc(std::ostream &) const = 0; - /// - virtual int docbook(std::ostream &) const = 0; - public: /// virtual void validate(LaTeXFeatures &) const; diff --git a/src/mathed/formulamacro.C b/src/mathed/formulamacro.C index d6f574aba0..cffb87b422 100644 --- a/src/mathed/formulamacro.C +++ b/src/mathed/formulamacro.C @@ -72,40 +72,40 @@ Inset * InsetFormulaMacro::clone(Buffer const &, bool) const } -void InsetFormulaMacro::write(ostream & os) const +void InsetFormulaMacro::write(Buffer const *, ostream & os) const { os << "FormulaMacro "; tmacro().write(os, false); } -int InsetFormulaMacro::latex(ostream & os, bool fragile, +int InsetFormulaMacro::latex(Buffer const *, ostream & os, bool fragile, bool /*free_spacing*/) const { tmacro().write(os, fragile); return 2; } -int InsetFormulaMacro::ascii(ostream & os, int) const +int InsetFormulaMacro::ascii(Buffer const *, ostream & os, int) const { tmacro().write(os, false); return 0; } -int InsetFormulaMacro::linuxdoc(ostream & os) const +int InsetFormulaMacro::linuxdoc(Buffer const * buf, ostream & os) const { - return ascii(os, 0); + return ascii(buf, os, 0); } -int InsetFormulaMacro::docbook(ostream & os) const +int InsetFormulaMacro::docbook(Buffer const * buf, ostream & os) const { - return ascii(os, 0); + return ascii(buf, os, 0); } -void InsetFormulaMacro::read(LyXLex & lex) +void InsetFormulaMacro::read(Buffer const *, LyXLex & lex) { MathMacroTemplate * t = mathed_parse_macro(lex); if (!t) diff --git a/src/mathed/formulamacro.h b/src/mathed/formulamacro.h index 842613ceae..4468277954 100644 --- a/src/mathed/formulamacro.h +++ b/src/mathed/formulamacro.h @@ -44,18 +44,20 @@ public: /// int width(BufferView *, LyXFont const &) const; /// - void draw(BufferView *,LyXFont const &, int, float &, bool) const; + void draw(BufferView *, LyXFont const &, int, float &, bool) const; /// - void read(LyXLex & lex); + void read(Buffer const *, LyXLex & lex); /// - int ascii(std::ostream &, int linelen) const; + void write(Buffer const *, std::ostream & os) const; /// - int latex(std::ostream & os, bool fragile, bool free_spc) const; + int ascii(Buffer const *, std::ostream &, int linelen) const; /// - int linuxdoc(std::ostream & os) const; + int latex(Buffer const *, std::ostream & os, bool fragile, bool free_spc) const; /// - int docbook(std::ostream &) const; + int linuxdoc(Buffer const *, std::ostream & os) const; + /// + int docbook(Buffer const *, std::ostream &) const; /// Inset * clone(Buffer const &, bool same_id = false) const; @@ -74,8 +76,6 @@ private: MathMacroTemplate const & tmacro() const; /// prefix in inset string prefix() const; - /// - void write(std::ostream & os) const; }; #endif diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index aa809f9393..6e62c43f5e 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -169,7 +169,7 @@ MathInset * MathCursor::parInset(int i) const } -void MathCursor::dump(char const * what) const +void MathCursor::dump(char const *) const { #if 0 lyxerr << "MC: " << what << "\n"; -- 2.39.2