On 26 Sep 2000, Jean-Marc Lasgouttes wrote:
> >>>>> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:
>
> Angus> What it does do: * The block-if statement in Buffer::readInset
> Angus> is rearranged to minimise bloat. All those occurences of
> par-> InsertInset(pos, inset, font);
> Angus> ++pos; reduced to only one.
>
> A somewhat different approach would have been to define a
> readInset(Inset*) method
>
> void readInset(Inset* inset) {
> inset->Read(this, lex)
> par->InsertInset(pos, inset, font);
> ++pos;
> }
>
> and use it as:
>
> if (tmptok == "Quotes") {
> readInset(new InsetQuotes);
> } else
> ...
>
> I am not sure it is better, your patch just got me thinking...
>
> JMarc
>
We can try a map of strings to functions creating the insets, so we don't
need a large "if/elseif/elseif/..." (i.e. have some Inset_Creator class
which encapsulates the map, gets a string and returns a newly created
inset. This means adding new insets will not require changes to Buffer.
Lior.