2012/6/24 Michael Stahl <mstahl@redhat.com>:
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 :)
It's on my TODO list -- or should I better file an EasyHack for it?
(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++.
Hmm... ok. But why not encapsulate this construct into a wrapper
method so that one does not need to repeat it at every position where
one wants to make such a lookup? Or would that introduce a circular
dependency? I put the point on my TODO list as well and will check it
in a few weeks when I understand C++ better.
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.