VclPtr tweaks post 5.4.2 ...

Julien Nabet serval2412 at yahoo.fr
Fri May 26 09:46:07 UTC 2017


On 26/05/2017 11:23, Michael Meeks wrote:
> Hi guys,
>
> 	Seems like people think this is a good idea; so here is what is planned
> - I'd love some help with it when we're post 5.4.2 - (it's a big change
> so avoiding hurting back-porting is important - with ~3k sites all over
> the code).
>
> 	Three reasonably simple changes:
>
> replace:	VclPtrInstance<Foo> pFoo( pParent );
> with:		auto pFoo = VclPtr<Foo>::Create( pParent );
>
> replace:	ScopedVclPtrInstance<Foo> pFoo( pParent );
> with:		auto pFoo = ScopedVclPtr<Foo>::Create( pParent );
>
> 	s/ScopedVclPtr/VclPtrAutoDispose/g
>
> 	Unless we come up with a better name for the last sed; one suggestion
> was 'guard' but guards are released - not disposed; unsure if there is a
> similar UNO helper concept - Stephan ?
Hi,

To be sure we don't mixup the replace patterns, we should begin with 2nd 
replace (ScopedVclPtrInstance).
Here's a regexp:
sed -e 's/ScopedVclPtrInstance<\(.*\)>[ ]\(.*\)([ ]*pParent[ ]*)/auto \2 
= ScopedVclPtr<\1>::Create(pParent)/g'

For VclPtrInstance one:
sed -e 's/VclPtrInstance<\(.*\)>[ ]\(.*\)([ ]*pParent[ ]*)/auto \2 = 
VclPtr<\1>::Create(pParent)/g'

Julien


More information about the LibreOffice mailing list