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/strfwd.h"
19 #include <boost/shared_ptr.hpp>
27 /// Creates command definitions
30 /// information for a definition
32 CmdDefInfo(FuncRequest const & f): func(f), locked(false) {}
33 /// the expanded FuncRequest
35 /// to avoid recursive calls
40 /// type for map between a macro name and its info
41 typedef std::map<std::string, boost::shared_ptr<CmdDefInfo> > CmdDefMap;
46 bool read(std::string const & def_file);
49 * Look up a definition, lock it and return the
50 * associated action if it is not locked.
51 * @param name the name of the command
52 * @param func contains the action on success
53 * @return true if lock was successful
55 bool lock(std::string const & name, FuncRequest & func);
57 /// release a locked definition
58 void release(std::string const & name);
62 /// possible reasons for not allowed definitions
63 enum newCmdDefResult {
71 * Add a new command definition.
72 * @param name internal recursion level
74 newCmdDefResult newCmdDef(std::string const & name,
75 std::string const & def);
81 /// Implementation is in LyX.cpp
82 extern CmdDef & theTopLevelCmdDef();