Possible option to simplify code?
Michael Stahl
mstahl at redhat.com
Sun Jun 24 09:28:05 PDT 2012
On 23/06/12 21:26, Philipp Riemer wrote:
> (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?
yes there is some room for improvement with these methods, see e.g. the
SupportsServiceImpl/GetSupportedServiceNamesImpl methods in
sw/inc/unobaseclass.hxx and usage in e.g. sw/source/unocore/unobkm.cxx.
guess it would make sense to deploy this more widely :)
> (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)>).
hmmm, adding such a method would be possible.
but you can already do something similar by using the STL algorithms;
there is a comphelper/stlunosequence.hxx that has some begin()/end()
functions that work on uno::Sequence, and with that you can just use
std::find() like on any STL container, which i guess is what's
appropriate in C++.
More information about the LibreOffice
mailing list