2001-02-13 17:08:51 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2001-04-25 19:33:52 +00:00
|
|
|
#include <iostream>
|
|
|
|
|
2001-03-01 14:07:43 +00:00
|
|
|
|
2001-02-13 17:08:51 +00:00
|
|
|
#include "math_macrotable.h"
|
|
|
|
#include "math_macro.h"
|
|
|
|
#include "math_macrotemplate.h"
|
2001-06-25 00:06:33 +00:00
|
|
|
#include "math_parser.h"
|
2001-11-08 12:06:56 +00:00
|
|
|
#include "math_mathmlstream.h"
|
2001-02-13 19:10:18 +00:00
|
|
|
#include "debug.h"
|
2001-11-08 12:15:12 +00:00
|
|
|
#include "math_support.h" // math_font_available
|
2001-02-13 17:08:51 +00:00
|
|
|
|
2001-07-26 16:14:23 +00:00
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
MathMacroTable::table_type MathMacroTable::macro_table;
|
2001-02-13 17:08:51 +00:00
|
|
|
|
|
|
|
|
2001-04-24 16:13:38 +00:00
|
|
|
void MathMacroTable::dump()
|
2001-02-13 17:08:51 +00:00
|
|
|
{
|
2001-11-08 12:06:56 +00:00
|
|
|
/*
|
2001-06-27 15:57:57 +00:00
|
|
|
lyxerr << "\n------------------------------------------\n";
|
2001-04-24 16:13:38 +00:00
|
|
|
table_type::const_iterator it;
|
|
|
|
for (it = macro_table.begin(); it != macro_table.end(); ++it)
|
2001-10-12 12:02:49 +00:00
|
|
|
lyxerr << it->first
|
|
|
|
<< " [" << it->second->asMacroTemplate()->nargs() << "] : "
|
|
|
|
<< it->second->cell(0) << "\n";
|
2001-08-01 16:48:06 +00:00
|
|
|
lyxerr << "------------------------------------------\n";
|
2001-11-08 12:06:56 +00:00
|
|
|
*/
|
2001-02-13 17:08:51 +00:00
|
|
|
}
|
|
|
|
|
2001-03-01 14:07:43 +00:00
|
|
|
|
2001-10-12 12:02:49 +00:00
|
|
|
MathAtom & MathMacroTable::provide(string const & name)
|
2001-06-25 00:06:33 +00:00
|
|
|
{
|
|
|
|
table_type::iterator pos = macro_table.find(name);
|
|
|
|
if (pos == macro_table.end()) {
|
|
|
|
lyxerr << "MathMacroTable::provideTemplate: no template with name '"
|
2001-08-01 16:48:06 +00:00
|
|
|
<< name << "' available.\n";
|
2001-06-25 00:06:33 +00:00
|
|
|
}
|
2001-08-07 08:40:14 +00:00
|
|
|
return pos->second;
|
2001-04-24 16:13:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-07-12 14:24:47 +00:00
|
|
|
void MathMacroTable::create(MathAtom const & at)
|
2001-04-24 16:13:38 +00:00
|
|
|
{
|
2002-07-12 14:24:47 +00:00
|
|
|
macro_table[at->asMacroTemplate()->name()] = at;
|
2002-03-27 18:04:36 +00:00
|
|
|
}
|
|
|
|
|
2001-10-12 12:02:49 +00:00
|
|
|
|
|
|
|
bool MathMacroTable::has(string const & name)
|
2001-04-24 16:13:38 +00:00
|
|
|
{
|
2001-10-12 12:02:49 +00:00
|
|
|
return macro_table.find(name) != macro_table.end();
|
2001-02-13 17:08:51 +00:00
|
|
|
}
|