fdo#46808, shiny UNO conversion: would be nice to have some additional helper methods
Noel Grandin
noel at peralex.com
Thu Aug 16 07:24:12 PDT 2012
Hi
I'm starting on this again:
https://bugs.freedesktop.org/show_bug.cgi?id=46808
Large chunks of the work are pretty mechanical, but it would make work
much easier if the auto-generated C++ had some additional helper methods.
(1) Down-conversion implicit conversion operators for converting from an
interface to it's sub-interfaces.
Which would help me replace this:
uno::Reference < i18n::XBreakIterator2 > xB2 =
i18n::BreakIterator2::create(xContext);
uno::Reference < i18n::XBreakIterator > xB1 =
uno::Reference<i18n::XBreakIterator>(xB2, uno::UNO_QUERY_THROW);
with this:
uno::Reference < i18n::XBreakIterator > xB1 =
i18n::BreakIterator2::create(xContext);
to simplify code when converting from the new interfaces to the old
interfaces, which happens a lot
because I don't want the changes to ripple out.
(2) A new version of the factory create method that uses the current
process component context.
i.e. instead of
uno::Reference< i18n::XBreakIterator > xLocalBreakIterator;
uno::Reference< uno::XComponentContext >
xContext(::comphelper::getProcessComponentContext());
xLocalBreakIterator.set(i18n::BreakIterator2::create(xContext));
I could write:
uno::Reference< i18n::XBreakIterator > xLocalBreakIterator;
xLocalBreakIterator.set(i18n::BreakIterator2::createWithProcessContext());
Thanks,
Noel Grandin
(yes, I do indeed pride myself on being a very lazy programmer :-)
Disclaimer: http://www.peralex.com/disclaimer.html
More information about the LibreOffice
mailing list