[PATCH V2] more conversion of tools/Table.hxx to std::map in editeng, sc and sw modules

Noel Grandin noel at peralex.com
Tue Feb 7 22:59:57 PST 2012



On 2012-02-08 08:40, David Tardon wrote:
> Why not split it into more patches, preferably one for each replaced 
> class? It would make review easier (and it would also make revert of 
> only one of the conversions easier, if it proves necessary ;-) A 
> couple of comments: 
Sure, will do.

> IMHO it would be more appropriate to use boost::ptr_map here. 
OK.

> You add "compatibility" functions here, but replace them by std::map 
> functions at other places. Are these so widely used it would be 
> impractical? 
In general I try not to produce too much code churn, so I create 
compatibility functions if I see more than about 5 uses.

>> -const com::sun::star::i18n::ForbiddenCharacters* SvxForbiddenCharactersTable::GetForbiddenCharacters( sal_uInt16 nLanguage, sal_Bool bGetDefault ) const
>> +const com::sun::star::i18n::ForbiddenCharacters* SvxForbiddenCharactersTable::GetForbiddenCharacters( sal_uInt16 nLanguage, sal_Bool bGetDefault )
>>   {
>> -    ForbiddenCharactersInfo* pInf = Get( nLanguage );
>> +    ForbiddenCharactersInfo* pInf = GetCharInfo( nLanguage );
>>       if ( !pInf&&  bGetDefault&&  mxMSF.is() )
>>       {
>> -        const SvxForbiddenCharactersTableImpl *pConstImpl = dynamic_cast<const SvxForbiddenCharactersTableImpl*>(this);
>> -        SvxForbiddenCharactersTableImpl* pImpl = const_cast<SvxForbiddenCharactersTableImpl*>(pConstImpl);
>> -         pInf = new ForbiddenCharactersInfo;
>> -        pImpl->Insert( nLanguage, pInf );
>> +        pInf = new ForbiddenCharactersInfo;
>> +        maCharInfoMap[ nLanguage ] = pInf;
>>
>>           pInf->bTemporary = sal_True;
>>           LocaleDataWrapper aWrapper( mxMSF, SvxCreateLocale( nLanguage ) );
> This function can remain const if you declare the maCharInfoMap member
> mutable. But that is just a nitpick :-)

This I don't understand - maCharInfoMap is not declared const, so how 
can I make it mutable?

Thanks for the feedback.


Disclaimer: http://www.peralex.com/disclaimer.html




More information about the LibreOffice mailing list