rgheck <rgh...@bobjweil.com> writes:

> Currently, if you repeat an InsetLayout declaration, it completely
> over-writes the original, rather than updating it, as ordinary Style
> declarations do. The attached patch, for trunk, aims to fix that
> problem. Comments welcome.

Very good. A few points:

> +             case TC_INSETLAYOUT: {
>                       if (lexrc.next()) {
[long stuff snipped]
> +                     } else {
> +                             lexrc.printError("No name given for 
> InsetLayout: `$$Token'.");
> +                             error = true;
>                       }

I would do
  if (!lexrc.next()) {
        lexrc.printError("No name given for InsetLayout: `$$Token'.");
        error = true;
        break;
  }
in order to save one indentation level.

> +bool TextClass::hasInsetLayout(docstring const & n) const
> +{
> +     if (n.empty()) 
> +             return false;
> +     InsetLayouts::const_iterator it = insetlayoutlist_.begin();
> +     InsetLayouts::const_iterator en = insetlayoutlist_.end();
> +     for (; it != en; ++it)
> +             if (n == it->first)
> +                     return true;
> +     return false;
> +}
> +
> +

Can't you use std::map::find() directly (aka insetlayoutlist_.find(n))?

JMarc


Reply via email to