4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Bernhard Roider
9 * Full author contact details are available in file CREDITS.
15 #include "FuncRequest.h"
17 #include "support/docstream.h"
19 #include <boost/shared_ptr.hpp>
26 /// Creates command definitions
29 /// information for a definition
31 CmdDefInfo(FuncRequest const & f): func(f), locked(false) {}
32 /// the expanded FuncRequest
34 /// to avoid recursive calls
39 /// type for map between a macro name and its info
40 typedef std::map<std::string, boost::shared_ptr<CmdDefInfo> > CmdDefMap;
45 bool read(std::string const & def_file);
48 * Look up a definition, lock it and return the
49 * associated action if it is not locked.
50 * @param name the name of the command
51 * @param func contains the action on success
52 * @return true if lock was successful
54 bool lock(std::string const & name, FuncRequest & func);
56 /// release a locked definition
57 void release(std::string const & name);
61 /// possible reasons for not allowed definitions
62 enum newCmdDefResult {
70 * Add a new command definition.
71 * @param name internal recursion level
73 newCmdDefResult newCmdDef(std::string const & name,
74 std::string const & def);
80 /// Implementation is in LyX.cpp
81 extern CmdDef & theTopLevelCmdDef();