some notes on SwClient and SwModify
bjoern.michaelsen at canonical.com
Mon Mar 23 02:27:29 PDT 2015
On Mon, Mar 23, 2015 at 09:54:45AM +0100, Miklos Vajna wrote:
> /home/vmiklos/git/libreoffice/master-clang/sw/source/core/doc/docfmt.cxx:657:26: error: c-style cast, type=5, from='const sw::WriterListener *', to='SwClient *', recommendedFix=static_cast [loplugin:cstylecast]
> while( 0 != ( pDep = (SwClient*)aCallMod.GetDepends()) )
> 1 error generated.
> Additional problem is that SwClient now inherits privately from
> ::sw::WriterListener, so not even a static_cast + const_cast will make
> the compiler happy.
> Could do const_cast + reinterpret_cast, but it doesn't sound like the
> right fix. What is the correct fix here? ;-)
for(SwClient* pClient = aIter.First(); pClient; pClient=aIter.Next())
should work: SwIterator is required to handle removal of Client gracefully (and
there is a unittest for that now). Also, when doing more than a plain
"Remove()", something like a SwIterator<SwFrm,SwModify> etc. takes care of most
of the casting for you internally.
So for now, SwIterator<> should help getting rid of the cast errors: IMHO
GetDepends() is an implementation detail that shouldnt be public anyway.
More information about the LibreOffice