]> git.lyx.org Git - lyx.git/blob - src/mathed/math_macrotable.C
e6475be71d65a9cba902815f29db3603a8aa3340
[lyx.git] / src / mathed / math_macrotable.C
1 /**
2  * \file math_macrotable.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author André Pönitz
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "math_macrotable.h"
14 #include "math_macrotemplate.h"
15 #include "debug.h"
16
17
18 using std::endl;
19
20
21 MathMacroTable::table_type MathMacroTable::macro_table;
22
23
24 void MathMacroTable::dump()
25 {
26 /*
27         lyxerr << "\n------------------------------------------" << endl;
28         table_type::const_iterator it;
29         for (it = macro_table.begin(); it != macro_table.end(); ++it)
30                 lyxerr << it->first
31                         << " [" << it->second->asMacroTemplate()->nargs() << "] : "
32                         << it->second->cell(0) << endl;
33         lyxerr << "------------------------------------------" << endl;
34 */
35 }
36
37
38 MathAtom & MathMacroTable::provide(string const & name)
39 {
40         table_type::iterator pos = macro_table.find(name);
41         if (pos == macro_table.end()) {
42                 lyxerr << "MathMacroTable::provideTemplate: no template with name '"
43                        << name << "' available." << endl;
44         }
45         return pos->second;
46 }
47
48
49 void MathMacroTable::create(MathAtom const & at)
50 {
51         macro_table[at->asMacroTemplate()->name()] = at;
52 }
53
54
55 bool MathMacroTable::has(string const & name)
56 {
57         return macro_table.find(name) != macro_table.end();
58 }