]> git.lyx.org Git - lyx.git/blob - src/mathed/math_macrotable.C
macro handling cleanup
[lyx.git] / src / mathed / math_macrotable.C
1 #include <config.h>
2
3 #include <iostream>
4
5 #ifdef __GNUG__
6 #pragma implementation
7 #endif
8
9 #include "math_macrotable.h"
10 #include "math_macro.h"
11 #include "math_macrotemplate.h"
12 #include "math_parser.h"
13 #include "math_mathmlstream.h"
14 #include "debug.h"
15 #include "math_support.h" // math_font_available
16
17
18 MathMacroTable::table_type MathMacroTable::macro_table;
19
20
21 void MathMacroTable::dump()
22 {
23 /*
24         lyxerr << "\n------------------------------------------\n";
25         table_type::const_iterator it;
26         for (it = macro_table.begin(); it != macro_table.end(); ++it)
27                 lyxerr << it->first
28                         << " [" << it->second->asMacroTemplate()->nargs() << "] : "
29                         << it->second->cell(0) << "\n";
30         lyxerr << "------------------------------------------\n";
31 */
32 }
33
34
35 MathAtom & MathMacroTable::provide(string const & name)
36 {
37         table_type::iterator pos = macro_table.find(name);
38         if (pos == macro_table.end()) {
39                 lyxerr << "MathMacroTable::provideTemplate: no template with name '"
40                        << name << "' available.\n";
41         }
42         return pos->second;
43 }
44
45
46 void MathMacroTable::create(MathAtom const & at)
47 {
48         macro_table[at->asMacroTemplate()->name()] = at;
49 }
50
51
52 bool MathMacroTable::has(string const & name)
53 {
54         return macro_table.find(name) != macro_table.end();
55 }