2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file math_macrotable.C
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
2001-02-13 17:08:51 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include "math_macrotable.h"
|
|
|
|
|
#include "math_macrotemplate.h"
|
2001-02-13 19:10:18 +00:00
|
|
|
|
#include "debug.h"
|
2001-02-13 17:08:51 +00:00
|
|
|
|
|
2003-08-02 11:30:30 +00:00
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
|
using std::string;
|
2003-08-02 11:30:30 +00:00
|
|
|
|
using std::endl;
|
|
|
|
|
|
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
|
|
|
|
/*
|
2003-08-02 11:30:30 +00:00
|
|
|
|
lyxerr << "\n------------------------------------------" << endl;
|
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() << "] : "
|
2003-08-02 11:30:30 +00:00
|
|
|
|
<< it->second->cell(0) << endl;
|
|
|
|
|
lyxerr << "------------------------------------------" << endl;
|
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 '"
|
2003-08-02 11:30:30 +00:00
|
|
|
|
<< name << "' available." << endl;
|
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
|
|
|
|
}
|