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