OutputParams refactoring
Richard Kimberly Heck
rikiheck at lyx.org
Fri Nov 6 16:04:46 UTC 2020
On 11/6/20 5:26 AM, Jean-Marc Lasgouttes wrote:
> Le 06/11/2020 à 10:57, Yuriy Skalko a écrit :
>> And to implement for OutputContext the push/pop operations (with
>> internal stack) to save/restore parent context (when needed to do
>> local changes) or directly modify parent context if changes should be
>> propagated on the higher level.
>
> Or use Changers.
I started a patch some time ago trying something like that method for
OutputParams generally. The destuctor for the new instance copied
relevant changes back to the one one. Basically something like:
class NewOutputParams : public OutputParams {
explicit NewOutputParams(OutputParams & oldop)
{ oldop_ = oldop; }
~NewOutputParams()
{
oldop_.is_child = is_child;
// do the same thing for other currently mutable members
}
private:
OutputParams oldop_;
}
In that case, though, it didn't solve the problem of mutable members.
Yuriy's idea of separating the two parts takes care of that problem, and
then changers could be used as you suggest.
Riki
More information about the lyx-devel
mailing list