Richard Heck wrote:
This patch addresses the remaining issue with crashes on ill-formed
inset-insert minibuffer commands. I've also added some comments
expressing my understanding of what's going on here.
+InsetCommandParams::InsetParamType
InsetCommandParams::command2ParamType(std::string const & cmd)
Maybe a map will achieve the same result and leads to cleaner code:
map<string, InsetBase::Code> icp_code;
icp_code["bibitem"] = BIBITEM_CODE;
icp_code["bibtex"] = BIBTEX_CODE;
icp_code["cite"] = CITATION_CODE;
icp_code["citet"] = CITATION_CODE;
icp_code["citealt"] = CITATION_CODE;
etc.
+//FIXME Support for keyval would be nice here and may be necessary
+//for support of some kinds of commands.
class InsetCommandParams {
- /// Get information for command \p name.
- /// Returns 0 if the command is not known.
+ /// Get information on what parameters command \p name takes.
+ /// Throws an ExceptionMessage if the command is not known.
static CommandInfo const * findInfo(std::string const & name);
Hum, instead of exception, I'd rather return InsetBase::NO_CODE and let
the caller decide if it is worth throwing an exception.
+ //It's not obvious this is the right place for this enum. Note that it
+ //serves a different purpose from the one in insetbase.C and so can't be
+ //replaced by it.
Couldn't they be merged instead? See above.
Abdel.