3 * \file MathMacroTable.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
12 #ifndef MATH_MACROTABLE_H
13 #define MATH_MACROTABLE_H
19 #include "support/docstring.h"
31 MacroData(docstring const & def, int nargs, docstring const & disp, std::string const &);
33 docstring def() const { return def_; }
35 docstring disp() const { return disp_; }
37 int numargs() const { return numargs_; }
38 /// replace #1,#2,... by given MathAtom 0,1,..
39 void expand(std::vector<MathArray> const & from, MathArray & to) const;
41 std::string requires() const { return requires_; }
43 std::string & requires() { return requires_; }
53 std::string requires_;
57 // This contains a table of "global" macros that are always accessible,
58 // either because they implement a feature of standard LaTeX or some
59 // hack to display certain contents nicely.
61 class MacroTable : public std::map<docstring, MacroData>
64 /// Parse full "\\def..." or "\\newcommand..." or ...
65 void insert(docstring const & definition, std::string const &);
66 /// Insert pre-digested macro definition
67 void insert(docstring const & name, MacroData const & data);
68 /// Do we have a macro by that name?
69 bool has(docstring const & name) const;
71 MacroData const & get(docstring const & name) const;
76 static MacroTable & globalMacros();
77 /// the local list hack
78 //static MacroTable & localMacros();