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
18 #include "support/docstring.h"
30 MacroData(docstring const & def, int nargs, docstring const & disp, std::string const &);
32 docstring def() const { return def_; }
34 docstring disp() const { return disp_; }
36 int numargs() const { return numargs_; }
37 /// replace #1,#2,... by given MathAtom 0,1,..
38 void expand(std::vector<MathArray> const & from, MathArray & to) const;
40 std::string requires() const { return requires_; }
42 std::string & requires() { return requires_; }
52 std::string requires_;
56 // This contains a table of "global" macros that are always accessible,
57 // either because they implement a feature of standard LaTeX or some
58 // hack to display certain contents nicely.
60 class MacroTable : public std::map<docstring, MacroData>
63 /// Parse full "\\def..." or "\\newcommand..." or ...
64 void insert(docstring const & definition, std::string const &);
65 /// Insert pre-digested macro definition
66 void insert(docstring const & name, MacroData const & data);
67 /// Do we have a macro by that name?
68 bool has(docstring const & name) const;
70 MacroData const & get(docstring const & name) const;
75 static MacroTable & globalMacros();
76 /// the local list hack
77 //static MacroTable & localMacros();