>>>>> "Juergen" == Juergen Spitzmueller <[EMAIL PROTECTED]> writes:

>> I would have thought that the 'else' part is enough. Is it
>> necessary to handle the case where there is no ','?

Juergen> I thought it is better to not go the complicated way if the
Juergen> inset contains only one item (which should be the common
Juergen> case). That's my real life thinking perhaps. I can delete the
Juergen> first statement if you wish. In theory, it should just work.

I'd prefer that indeed.

Real life speed is probably comparable (and the difference will be
smaller with the insetcommand code that has been posted recently).

Juergen> I will present a solution which prevents this special case
Juergen> after this patch is in, but there are other such cases, and I
Juergen> feel really safer if we keep the unique check.

OK.

Juergen> Is there still something missing?

Let's see...

  +void InsetCommand::replaceContents(std::string const & from, string const & 
to)
  +{
  +     if (getContents() != from)
  +             return;
  +     setContents(to);
  +}

I'd rather do
  +     if (getContents() == from)
  +             setContents(to);
but it is not very important.


  +     BOOST_ASSERT(code == InsetBase::CITE_CODE || InsetBase::REF_CODE);

This is wrong. It should be
        BOOST_ASSERT(code == InsetBase::CITE_CODE || code == 
InsetBase::REF_CODE);


  +     for (InsetIterator it = inset_iterator_begin(inset()); it; ++it) {
  +             if (it->lyxCode() == code) {
  +                     InsetCommand & inset = dynamic_cast<InsetCommand 
&>(*it);

Do we use dynamic_cast yet? Lars?

JMarc

Reply via email to