Some improvements to the UNOIDL SourceTreeProvider

Trying to do

$ instdir/sdk/bin/unoidl-read udkapi

(i.e., parsing the udkapi/com/sun/star/**.idl tree and printing it out): first
failed with

> Bad input <file:///.../udkapi/com/sun/star/beans/theIntrospection.idl>: source file defines more than one entity

because of its

> published interface XIntrospection;

forward declaration, so ignore such interface forward declarations; then failed
with

> Bad input <file:///.../udkapi/com/sun/star/modules.idl>: source file defines no entity

because "this file contains documentation of the modules", so ignore such
effectively empty files; then failed with

> Bad input <file:///.../udkapi/type_reference/udkapi.idl>: source file defines more than one entity

so instead do

$ mkdir TMP
$ cp -r udkapi/com TMP/
$ instdir/sdk/bin/unoidl-read TMP
$ rm -r TMP

which succeeded.

Change-Id: I465052539b474733e7945b312c996af27a034335
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164094
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
This commit is contained in:
Stephan Bergmann
2024-02-28 16:01:38 +01:00
parent 1037edf4ec
commit 741f88c9ec
+5 -4
View File
@@ -195,8 +195,7 @@ rtl::Reference<Entity> Cursor::getNext(OUString * name) {
}
auto ent = data.entities.end();
for (auto j = data.entities.begin(); j != data.entities.end(); ++j) {
if (j->second.kind == SourceProviderEntity::KIND_EXTERNAL
|| j->second.kind == SourceProviderEntity::KIND_MODULE)
if (j->second.kind != SourceProviderEntity::KIND_LOCAL)
{
continue;
}
@@ -207,8 +206,10 @@ rtl::Reference<Entity> Cursor::getNext(OUString * name) {
ent = j;
}
if (ent == data.entities.end()) {
throw FileFormatException(
stat.getFileURL(), "source file defines no entity");
SAL_INFO(
"unoidl",
"source file <" << stat.getFileURL() << "> defines no entity");
continue;
}
//TODO: Check that the entity's name matches the suffix of stat.getFileURL():
*name = ent->first.copy(ent->first.lastIndexOf('.') + 1);