From 28fa90eda0a3d95aa95c8732025ff26a02de62ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Wed, 27 Mar 2002 11:02:56 +0000 Subject: [PATCH] small interface cleanup git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3851 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/formulamacro.C | 4 ++-- src/mathed/formulamacro.h | 2 +- src/mathed/math_macrotable.C | 9 ++++++++- src/mathed/math_macrotable.h | 10 ++++++---- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/mathed/formulamacro.C b/src/mathed/formulamacro.C index 3d048a5b79..48d87cf403 100644 --- a/src/mathed/formulamacro.C +++ b/src/mathed/formulamacro.C @@ -47,10 +47,10 @@ InsetFormulaMacro::InsetFormulaMacro() } -InsetFormulaMacro::InsetFormulaMacro(string name, int nargs) +InsetFormulaMacro::InsetFormulaMacro(string const & name, int nargs) { setInsetName(name); - MathMacroTable::create(name, nargs, string()); + MathMacroTable::create(name, nargs); } diff --git a/src/mathed/formulamacro.h b/src/mathed/formulamacro.h index 5fb3b4e1c6..c9d61785d0 100644 --- a/src/mathed/formulamacro.h +++ b/src/mathed/formulamacro.h @@ -34,7 +34,7 @@ public: /// InsetFormulaMacro(); /// construct a macro hull from its name and the number of arguments - explicit InsetFormulaMacro(string name, int na); + explicit InsetFormulaMacro(string const & name, int nargs); /// constructs a mocro from its LaTeX definition explicit InsetFormulaMacro(string const & s); /// diff --git a/src/mathed/math_macrotable.C b/src/mathed/math_macrotable.C index 9d373a71d3..4b948fecaa 100644 --- a/src/mathed/math_macrotable.C +++ b/src/mathed/math_macrotable.C @@ -47,10 +47,17 @@ MathAtom & MathMacroTable::provide(string const & name) } +void MathMacroTable::create(string const & name, int na) +{ + macro_table[name] = MathAtom(new MathMacroTemplate(name, na)); +} + + void MathMacroTable::create(string const & name, int na, string const & text) { MathAtom t(new MathMacroTemplate(name, na)); - mathed_parse_cell(t->cell(0), text); + mathed_parse_cell(t->cell(0), name); + mathed_parse_cell(t->cell(1), text); macro_table[name] = t; } diff --git a/src/mathed/math_macrotable.h b/src/mathed/math_macrotable.h index 098a85c148..3400bf915e 100644 --- a/src/mathed/math_macrotable.h +++ b/src/mathed/math_macrotable.h @@ -16,7 +16,7 @@ class MathArray; struct MathMacroTable { public: /// - static void create(string const &, int, string const &); + static void create(string const &, int); /// static void create(string const &, int, MathArray const &, MathArray const &); /// @@ -25,13 +25,15 @@ public: static bool has(string const &); /// static void builtinMacros(); + /// + static void dump(); private: + /// create internal macros (like \longrightarrow...) + static void create(string const &, int, string const &); + /// typedef std::map table_type; // static table_type macro_table; -public: - /// - static void dump(); }; #endif