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>
28 /// Creates command definitions
31 /// information for a definition
33 CmdDefInfo(FuncRequest const & f): func(f), locked(false) {}
34 /// the expanded FuncRequest
36 /// to avoid recursive calls
41 /// type for map between a macro name and its info
42 typedef std::map<std::string, boost::shared_ptr<CmdDefInfo> > CmdDefMap;
47 bool read(std::string const & def_file);
50 * Look up a definition, lock it and return the
51 * associated action if it is not locked.
52 * @param name the name of the command
53 * @param func contains the action on success
54 * @return true if lock was successful
56 bool lock(std::string const & name, FuncRequest & func);
58 /// release a locked definition
59 void release(std::string const & name);
63 /// possible reasons for not allowed definitions
64 enum newCmdDefResult {
72 * Add a new command definition.
73 * @param name internal recursion level
75 newCmdDefResult newCmdDef(std::string const & name,
76 std::string const & def);
82 /// Implementation is in LyX.cpp
83 extern CmdDef & theTopLevelCmdDef();