Converting java unit test to cppunit

Markus Mohrhard markus.mohrhard at googlemail.com
Fri Aug 3 21:58:39 UTC 2018


Hello Rahul,


On Fri, Aug 3, 2018 at 7:27 PM, Rahul Gurung <gurungrahul2 at gmail.com> wrote:

> Hi,
>
> I am trying to convert java unit tests to cppunit test and I am currently
> studying old commits, and came across this line,
>
>
> "UnoRuntime.queryInterface (XArrayFormulaRange.class, new_range);"
>
> I checked the documentation but couldn't find what this
> XArrayFormulaRange.class means, can anyone explain? I am new to Open Source.
>
>
>
UNO (our extension framework) works through interfaces. Usually names
starting with X like XArrayFormulaRange are an interface (
https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1sheet_1_1XArrayFormulaRange.html
).

To access the corresponding methods of an interface that an object
implements we need to cast between the different interfaces. This is done
in Java through UnoRuntime.queryInterface and in C++ through
uno::Reference<XArrayFormulaRange>(new_range, UNO_QUERY);

Jens Carl is currently working on the same task and has many existing
patches that you can use to understand how to convert existing code. A
recent example is
https://cgit.freedesktop.org/libreoffice/core/commit/?id=8164399df0df976784ddc1a76b46939c53ae51ee
but you can find many more through
https://cgit.freedesktop.org/libreoffice/core/log/?qt=grep&q=45904

Regards,
Markus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20180803/c9ec2f47/attachment.html>


More information about the LibreOffice mailing list