Possible option to simplify code?

Philipp Riemer ruderphilipp at gmail.com
Sat Jun 23 12:26:02 PDT 2012


Hi Miklos, hi all,

I looked at your recent commit at
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=833bc9014505d20f25186e7dcf583d34fc9f114e>
and a duplication in the code of
"sw/source/core/unocore/SwXTextDefaults.cxx" caught my eye. Since I
never programmed in C++ so far, I want to ask you here because I am
not sure if this is easily possible:

(1) Wouldn't it be better in the method
"SwXTextDefaults::supportsService" to use the output of
"SwXTextDefaults::getSupportedServiceNames" and make an "is in array?"
check there instead of duplicating the allowed/supported string
values?

(2) I skimmed over the file "cppu/inc/com/sun/star/uno/Sequence.hxx"
since (a) there are no Doxygen pages for this module and (b) this
seems to be the return value of
"SwXTextDefaults::getSupportedServiceNames". As far as I understand,
this class does not provide any option to do such a simple "contains?"
checking (like e.g. the Java Collection class
<http://docs.oracle.com/javase/6/docs/api/java/util/Collection.html#contains(java.lang.Object)>).
Am I right? If so, would it be easy to add that and afterwards change
such occurrences like the one mentioned above?

Cheers,
Philipp


More information about the LibreOffice mailing list