[Libreoffice] Moving duplicate code into methods

Thorsten Behrens thb at documentfoundation.org
Tue May 3 00:24:40 PDT 2011

Chr. Rossmanith wrote:
> I've found two duplicate code with simian and moved it into two new
> methods which saves 229 lines of code. It would be nice if someone
> could review the patch and at least suggest better names for the
> methods...
Nice, good work - 

> @@ -104,6 +104,118 @@ using namespace ::com::sun::star::lang;
>  using namespace ::com::sun::star::beans;
>  using namespace ::com::sun::star::drawing;
> +
> +void rSegInfo_nSDat_method (EnhancedCustomShapeSegment& rSegInfo, sal_uInt16 nSDat)
ShapeSegmentFromBinary() maybe?

> +sal_Int32 GetNumberOfProperties ( const SvxMSDffHandle* pData )
> +void SetProperties (const SvxMSDffHandle* pData, com::sun::star::beans::PropertyValues& rPropValues)
looks ok to me - or maybe ShapePropertiesFromDFF or somesuch, as
set/getProps sounds somehow generic (and is quite heavily overloaded
as a name).

Additionally, please make those methods static (they're only used
inside that file) - and another loosely followed convention is to
prefix those local methods with either "lcl_" or "Impl"/"impl".

Though that's a matter of taste ... ;)


-- Thorsten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110503/ca5cc342/attachment.pgp>

More information about the LibreOffice mailing list