24#include <com/sun/star/container/NoSuchElementException.hpp>
25#include <com/sun/star/lang/IllegalArgumentException.hpp>
26#include <com/sun/star/reflection/NoSuchTypeNameException.hpp>
27#include <com/sun/star/reflection/TypeDescriptionSearchDepth.hpp>
28#include <com/sun/star/reflection/XConstantTypeDescription.hpp>
29#include <com/sun/star/reflection/XConstantsTypeDescription.hpp>
30#include <com/sun/star/reflection/XEnumTypeDescription.hpp>
31#include <com/sun/star/reflection/XIndirectTypeDescription.hpp>
32#include <com/sun/star/reflection/XInterfaceAttributeTypeDescription2.hpp>
33#include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
34#include <com/sun/star/reflection/XInterfaceTypeDescription2.hpp>
35#include <com/sun/star/reflection/XModuleTypeDescription.hpp>
36#include <com/sun/star/reflection/XPublished.hpp>
37#include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
38#include <com/sun/star/reflection/XSingletonTypeDescription2.hpp>
39#include <com/sun/star/reflection/XStructTypeDescription.hpp>
40#include <com/sun/star/reflection/XTypeDescription.hpp>
41#include <com/sun/star/uno/Any.hxx>
42#include <com/sun/star/uno/DeploymentException.hpp>
43#include <com/sun/star/uno/Reference.hxx>
44#include <com/sun/star/uno/RuntimeException.hpp>
45#include <com/sun/star/uno/Sequence.hxx>
46#include <com/sun/star/uno/Type.hxx>
47#include <com/sun/star/uno/TypeClass.hpp>
51#include <osl/file.hxx>
53#include <rtl/ustring.hxx>
66OUString makePrefix(OUString
const & name) {
70css::uno::Any resolveTypedefs(css::uno::Any
const & type) {
71 for (css::uno::Any
t(type);;) {
72 css::uno::Reference< css::reflection::XIndirectTypeDescription > ind(
73 type, css::uno::UNO_QUERY);
74 if (!ind.is() || ind->getTypeClass() != css::uno::TypeClass_TYPEDEF) {
77 t <<= ind->getReferencedType();
81class SimpleTypeDescription:
82 public cppu::WeakImplHelper< css::reflection::XTypeDescription >
85 SimpleTypeDescription(
86 css::uno::TypeClass typeClass, OUString name):
91 virtual ~SimpleTypeDescription()
override {}
93 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
94 {
return typeClass_; }
96 virtual OUString SAL_CALL getName()
override
99 css::uno::TypeClass typeClass_;
103class SequenceTypeDescription:
104 public cppu::WeakImplHelper< css::reflection::XIndirectTypeDescription >
107 SequenceTypeDescription(
109 OUString name, OUString componentType):
114 virtual ~SequenceTypeDescription()
override {}
116 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
117 {
return css::uno::TypeClass_SEQUENCE; }
119 virtual OUString SAL_CALL getName()
override
122 virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
123 getReferencedType()
override
124 {
return manager_->resolve(componentType_); }
128 OUString componentType_;
131class PublishableDescription:
132 public cppu::WeakImplHelper< css::reflection::XPublished >
135 explicit PublishableDescription(
bool published): published_(published) {}
137 virtual ~PublishableDescription()
override {}
140 virtual sal_Bool SAL_CALL isPublished()
override
141 {
return published_; }
146class ModuleDescription:
147 public cppu::WeakImplHelper< css::reflection::XModuleTypeDescription >
155 { assert(
manager.is()); assert(entity.is()); }
158 virtual ~ModuleDescription()
override {}
160 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
161 {
return css::uno::TypeClass_MODULE; }
163 virtual OUString SAL_CALL getName()
override
168 css::uno::Reference< css::reflection::XTypeDescription > >
169 SAL_CALL getMembers()
override;
176css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
177ModuleDescription::getMembers() {
179 std::vector< OUString > names(entity_->getMemberNames());
180 assert(names.size() <= SAL_MAX_INT32);
181 sal_Int32
n =
static_cast< sal_Int32
>(names.size());
183 css::uno::Reference< css::reflection::XTypeDescription > > s(n);
184 auto r = asNonConstRange(s);
185 for (sal_Int32 i = 0;
i !=
n; ++
i) {
186 r[
i] =
manager_->resolve(makePrefix(name_) + names[i]);
190 throw css::uno::DeploymentException(
196typedef cppu::ImplInheritanceHelper<
197 PublishableDescription, css::reflection::XEnumTypeDescription >
198EnumTypeDescription_Base;
200class EnumTypeDescription:
public EnumTypeDescription_Base {
205 EnumTypeDescription_Base(entity->isPublished()),
name_(
std::move(
name)),
207 { assert(entity.is()); }
210 virtual ~EnumTypeDescription()
override {}
212 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
213 {
return css::uno::TypeClass_ENUM; }
215 virtual OUString SAL_CALL getName()
override
218 virtual sal_Int32 SAL_CALL getDefaultEnumValue()
override
219 {
return entity_->getMembers()[0].value; }
221 virtual css::uno::Sequence< OUString > SAL_CALL getEnumNames()
override;
223 virtual css::uno::Sequence< sal_Int32 > SAL_CALL getEnumValues()
override;
229css::uno::Sequence< OUString > EnumTypeDescription::getEnumNames()
231 assert(entity_->getMembers().size() <= SAL_MAX_INT32);
232 sal_Int32
n =
static_cast< sal_Int32
>(entity_->getMembers().size());
233 css::uno::Sequence< OUString > s(n);
234 auto r = asNonConstRange(s);
235 for (sal_Int32 i = 0;
i !=
n; ++
i) {
236 r[
i] = entity_->getMembers()[
i].name;
241css::uno::Sequence< sal_Int32 > EnumTypeDescription::getEnumValues()
243 assert(entity_->getMembers().size() <= SAL_MAX_INT32);
244 sal_Int32
n =
static_cast< sal_Int32
>(entity_->getMembers().size());
245 css::uno::Sequence< sal_Int32 > s(n);
246 auto r = asNonConstRange(s);
247 for (sal_Int32 i = 0;
i !=
n; ++
i) {
248 r[
i] = entity_->getMembers()[
i].value;
253typedef cppu::ImplInheritanceHelper<
254 PublishableDescription, css::reflection::XStructTypeDescription >
255PlainStructTypeDescription_Base;
257class PlainStructTypeDescription:
public PlainStructTypeDescription_Base {
259 PlainStructTypeDescription(
263 PlainStructTypeDescription_Base(entity->isPublished()),
265 { assert(
manager.is()); assert(entity.is()); }
268 virtual ~PlainStructTypeDescription()
override {}
270 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
271 {
return css::uno::TypeClass_STRUCT; }
273 virtual OUString SAL_CALL getName()
override
276 virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
277 getBaseType()
override {
278 return entity_->getDirectBase().isEmpty()
279 ? css::uno::Reference< css::reflection::XTypeDescription >()
280 :
manager_->resolve(entity_->getDirectBase());
285 css::uno::Reference< css::reflection::XTypeDescription > >
286 SAL_CALL getMemberTypes()
override;
288 virtual css::uno::Sequence< OUString > SAL_CALL getMemberNames()
override;
290 virtual css::uno::Sequence< OUString > SAL_CALL getTypeParameters()
override
291 {
return css::uno::Sequence< OUString >(); }
295 css::uno::Reference< css::reflection::XTypeDescription > >
296 SAL_CALL getTypeArguments()
override {
297 return css::uno::Sequence<
298 css::uno::Reference< css::reflection::XTypeDescription > >();
306css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
307PlainStructTypeDescription::getMemberTypes()
309 assert(entity_->getDirectMembers().size() <= SAL_MAX_INT32);
310 sal_Int32
n =
static_cast< sal_Int32
>(entity_->getDirectMembers().size());
312 css::uno::Reference< css::reflection::XTypeDescription > > s(n);
313 auto r = asNonConstRange(s);
314 for (sal_Int32 i = 0;
i !=
n; ++
i) {
315 r[
i] =
manager_->resolve(entity_->getDirectMembers()[i].type);
320css::uno::Sequence< OUString > PlainStructTypeDescription::getMemberNames()
322 assert(entity_->getDirectMembers().size() <= SAL_MAX_INT32);
323 sal_Int32
n =
static_cast< sal_Int32
>(entity_->getDirectMembers().size());
324 css::uno::Sequence< OUString > s(n);
325 auto r = asNonConstRange(s);
326 for (sal_Int32 i = 0;
i !=
n; ++
i) {
327 r[
i] = entity_->getDirectMembers()[
i].name;
332class ParameterizedMemberTypeDescription:
333 public cppu::WeakImplHelper< css::reflection::XTypeDescription >
336 explicit ParameterizedMemberTypeDescription(
337 OUString typeParameterName):
338 typeParameterName_(
std::move(typeParameterName))
342 virtual ~ParameterizedMemberTypeDescription()
override {}
344 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
345 {
return css::uno::TypeClass_UNKNOWN; }
347 virtual OUString SAL_CALL getName()
override
348 {
return typeParameterName_; }
350 OUString typeParameterName_;
353typedef cppu::ImplInheritanceHelper<
354 PublishableDescription, css::reflection::XStructTypeDescription >
355PolymorphicStructTypeTemplateDescription_Base;
357class PolymorphicStructTypeTemplateDescription:
358 public PolymorphicStructTypeTemplateDescription_Base
361 PolymorphicStructTypeTemplateDescription(
366 PolymorphicStructTypeTemplateDescription_Base(entity->isPublished()),
368 { assert(
manager.is()); assert(entity.is()); }
371 virtual ~PolymorphicStructTypeTemplateDescription()
override {}
373 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
374 {
return css::uno::TypeClass_STRUCT; }
376 virtual OUString SAL_CALL getName()
override
379 virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
380 getBaseType()
override
381 {
return css::uno::Reference< css::reflection::XTypeDescription >(); }
385 css::uno::Reference< css::reflection::XTypeDescription > >
386 SAL_CALL getMemberTypes()
override;
388 virtual css::uno::Sequence< OUString > SAL_CALL getMemberNames()
override;
390 virtual css::uno::Sequence< OUString > SAL_CALL getTypeParameters()
override;
394 css::uno::Reference< css::reflection::XTypeDescription > >
395 SAL_CALL getTypeArguments()
override {
396 return css::uno::Sequence<
397 css::uno::Reference< css::reflection::XTypeDescription > >();
405css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
406PolymorphicStructTypeTemplateDescription::getMemberTypes()
408 assert(entity_->getMembers().size() <= SAL_MAX_INT32);
409 sal_Int32
n =
static_cast< sal_Int32
>(entity_->getMembers().size());
411 css::uno::Reference< css::reflection::XTypeDescription > > s(n);
412 auto r = asNonConstRange(s);
413 for (sal_Int32 i = 0;
i !=
n; ++
i) {
414 r[
i] = entity_->getMembers()[
i].parameterized
415 ?
new ParameterizedMemberTypeDescription(
416 entity_->getMembers()[i].type)
422css::uno::Sequence< OUString >
423PolymorphicStructTypeTemplateDescription::getMemberNames()
425 assert(entity_->getMembers().size() <= SAL_MAX_INT32);
426 sal_Int32
n =
static_cast< sal_Int32
>(entity_->getMembers().size());
427 css::uno::Sequence< OUString > s(n);
428 auto r = asNonConstRange(s);
429 for (sal_Int32 i = 0;
i !=
n; ++
i) {
430 r[
i] = entity_->getMembers()[
i].name;
435css::uno::Sequence< OUString >
436PolymorphicStructTypeTemplateDescription::getTypeParameters()
438 assert(entity_->getTypeParameters().size() <= SAL_MAX_INT32);
439 sal_Int32
n =
static_cast< sal_Int32
>(entity_->getTypeParameters().size());
440 css::uno::Sequence< OUString > s(n);
441 auto r = asNonConstRange(s);
442 for (sal_Int32 i = 0;
i !=
n; ++
i) {
443 r[
i] = entity_->getTypeParameters()[
i];
448class InstantiatedPolymorphicStructTypeDescription:
449 public cppu::WeakImplHelper< css::reflection::XStructTypeDescription >
452 InstantiatedPolymorphicStructTypeDescription(
457 std::vector< OUString >&& arguments):
462 assert(arguments_.size() == entity->getTypeParameters().size());
466 virtual ~InstantiatedPolymorphicStructTypeDescription()
override {}
468 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
469 {
return css::uno::TypeClass_STRUCT; }
471 virtual OUString SAL_CALL getName()
override
474 virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
475 getBaseType()
override
476 {
return css::uno::Reference< css::reflection::XTypeDescription >(); }
480 css::uno::Reference< css::reflection::XTypeDescription > >
481 SAL_CALL getMemberTypes()
override;
483 virtual css::uno::Sequence< OUString > SAL_CALL getMemberNames()
override;
485 virtual css::uno::Sequence< OUString > SAL_CALL getTypeParameters()
override
486 {
return css::uno::Sequence< OUString >(); }
490 css::uno::Reference< css::reflection::XTypeDescription > >
491 SAL_CALL getTypeArguments()
override;
496 std::vector< OUString > arguments_;
499css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
500InstantiatedPolymorphicStructTypeDescription::getMemberTypes()
502 assert(entity_->getMembers().size() <= SAL_MAX_INT32);
503 sal_Int32
n =
static_cast< sal_Int32
>(entity_->getMembers().size());
505 css::uno::Reference< css::reflection::XTypeDescription > > s(n);
506 auto r = asNonConstRange(s);
507 for (sal_Int32 i = 0;
i !=
n; ++
i) {
508 OUString
type(entity_->getMembers()[i].type);
509 if (entity_->getMembers()[i].parameterized) {
510 auto j = std::find(entity_->getTypeParameters().begin(), entity_->getTypeParameters().end(), type);
511 if (j != entity_->getTypeParameters().end()) {
512 type = arguments_[j - entity_->getTypeParameters().begin()];
523css::uno::Sequence< OUString >
524InstantiatedPolymorphicStructTypeDescription::getMemberNames()
526 assert(entity_->getMembers().size() <= SAL_MAX_INT32);
527 sal_Int32
n =
static_cast< sal_Int32
>(entity_->getMembers().size());
528 css::uno::Sequence< OUString > s(n);
529 auto r = asNonConstRange(s);
530 for (sal_Int32 i = 0;
i !=
n; ++
i) {
531 r[
i] = entity_->getMembers()[
i].name;
535css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
536InstantiatedPolymorphicStructTypeDescription::getTypeArguments()
538 assert(arguments_.size() <= SAL_MAX_INT32);
539 sal_Int32
n =
static_cast< sal_Int32
>(arguments_.size());
541 css::uno::Reference< css::reflection::XTypeDescription > > s(n);
542 auto r = asNonConstRange(s);
543 for (sal_Int32 i = 0;
i !=
n; ++
i) {
549typedef cppu::ImplInheritanceHelper<
550 PublishableDescription, css::reflection::XCompoundTypeDescription >
551ExceptionTypeDescription_Base;
553class ExceptionTypeDescription:
public ExceptionTypeDescription_Base {
555 ExceptionTypeDescription(
559 ExceptionTypeDescription_Base(entity->isPublished()),
manager_(
manager),
561 { assert(
manager.is()); assert(entity.is()); }
564 virtual ~ExceptionTypeDescription()
override {}
566 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
567 {
return css::uno::TypeClass_EXCEPTION; }
569 virtual OUString SAL_CALL getName()
override
572 virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
573 getBaseType()
override {
574 return entity_->getDirectBase().isEmpty()
575 ? css::uno::Reference< css::reflection::XTypeDescription >()
576 :
manager_->resolve(entity_->getDirectBase());
581 css::uno::Reference< css::reflection::XTypeDescription > >
582 SAL_CALL getMemberTypes()
override;
584 virtual css::uno::Sequence< OUString > SAL_CALL getMemberNames()
override;
591css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
592ExceptionTypeDescription::getMemberTypes() {
593 assert(entity_->getDirectMembers().size() <= SAL_MAX_INT32);
594 sal_Int32
n =
static_cast< sal_Int32
>(entity_->getDirectMembers().size());
596 css::uno::Reference< css::reflection::XTypeDescription > > s(n);
597 auto r = asNonConstRange(s);
598 for (sal_Int32 i = 0;
i !=
n; ++
i) {
599 r[
i] =
manager_->resolve(entity_->getDirectMembers()[i].type);
604css::uno::Sequence< OUString > ExceptionTypeDescription::getMemberNames()
606 assert(entity_->getDirectMembers().size() <= SAL_MAX_INT32);
607 sal_Int32
n =
static_cast< sal_Int32
>(entity_->getDirectMembers().size());
608 css::uno::Sequence< OUString > s(n);
609 auto r = asNonConstRange(s);
610 for (sal_Int32 i = 0;
i !=
n; ++
i) {
611 r[
i] = entity_->getDirectMembers()[
i].name;
616class AttributeDescription:
617 public cppu::WeakImplHelper<
618 css::reflection::XInterfaceAttributeTypeDescription2 >
621 AttributeDescription(
631 virtual ~AttributeDescription()
override {}
633 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
634 {
return css::uno::TypeClass_INTERFACE_ATTRIBUTE; }
636 virtual OUString SAL_CALL getName()
override
639 virtual OUString SAL_CALL getMemberName()
override
640 {
return attribute_.name; }
642 virtual sal_Int32 SAL_CALL getPosition()
override
643 {
return position_; }
645 virtual sal_Bool SAL_CALL isReadOnly()
override
646 {
return attribute_.readOnly; }
648 virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
650 {
return manager_->resolve(attribute_.type); }
652 virtual sal_Bool SAL_CALL isBound()
override
653 {
return attribute_.bound; }
657 css::uno::Reference< css::reflection::XCompoundTypeDescription > >
658 SAL_CALL getGetExceptions()
override;
662 css::uno::Reference< css::reflection::XCompoundTypeDescription > >
663 SAL_CALL getSetExceptions()
override;
672 css::uno::Reference< css::reflection::XCompoundTypeDescription > >
673AttributeDescription::getGetExceptions() {
674 assert(attribute_.getExceptions.size() <= SAL_MAX_INT32);
675 sal_Int32
n =
static_cast< sal_Int32
>(attribute_.getExceptions.size());
677 css::uno::Reference< css::reflection::XCompoundTypeDescription > > s(n);
678 auto r = asNonConstRange(s);
679 for (sal_Int32 i = 0;
i !=
n; ++
i) {
681 manager_->resolve(attribute_.getExceptions[i]),
682 css::uno::UNO_QUERY_THROW);
688 css::uno::Reference< css::reflection::XCompoundTypeDescription > >
689AttributeDescription::getSetExceptions() {
690 assert(attribute_.setExceptions.size() <= SAL_MAX_INT32);
691 sal_Int32
n =
static_cast< sal_Int32
>(attribute_.setExceptions.size());
693 css::uno::Reference< css::reflection::XCompoundTypeDescription > > s(n);
694 auto r = asNonConstRange(s);
695 for (sal_Int32 i = 0;
i !=
n; ++
i) {
697 manager_->resolve(attribute_.setExceptions[i]),
698 css::uno::UNO_QUERY_THROW);
703class MethodParameter:
704 public cppu::WeakImplHelper< css::reflection::XMethodParameter >
715 virtual ~MethodParameter()
override {}
717 virtual OUString SAL_CALL getName()
override
718 {
return parameter_.name; }
720 virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
722 {
return manager_->resolve(parameter_.type); }
724 virtual sal_Bool SAL_CALL isIn()
override {
726 (parameter_.direction
728 || (parameter_.direction
733 virtual sal_Bool SAL_CALL isOut()
override {
735 (parameter_.direction
737 || (parameter_.direction
742 virtual sal_Int32 SAL_CALL getPosition()
override
743 {
return position_; }
750class MethodDescription:
751 public cppu::WeakImplHelper<
752 css::reflection::XInterfaceMethodTypeDescription >
763 virtual ~MethodDescription()
override {}
765 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
766 {
return css::uno::TypeClass_INTERFACE_METHOD; }
768 virtual OUString SAL_CALL getName()
override
771 virtual OUString SAL_CALL getMemberName()
override
772 {
return method_.name; }
774 virtual sal_Int32 SAL_CALL getPosition()
override
775 {
return position_; }
777 virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
778 getReturnType()
override
779 {
return manager_->resolve(method_.returnType); }
781 virtual sal_Bool SAL_CALL isOneway()
override
786 css::uno::Reference< css::reflection::XMethodParameter > >
787 SAL_CALL getParameters()
override;
791 css::uno::Reference< css::reflection::XTypeDescription > >
792 SAL_CALL getExceptions()
override;
800css::uno::Sequence< css::uno::Reference< css::reflection::XMethodParameter > >
801MethodDescription::getParameters() {
802 assert(method_.parameters.size() <= SAL_MAX_INT32);
803 sal_Int32
n =
static_cast< sal_Int32
>(method_.parameters.size());
805 css::uno::Reference< css::reflection::XMethodParameter > > s(n);
806 auto r = asNonConstRange(s);
807 for (sal_Int32 i = 0;
i !=
n; ++
i) {
808 r[
i] =
new MethodParameter(manager_, method_.parameters[i], i);
813css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
814MethodDescription::getExceptions() {
815 assert(method_.exceptions.size() <= SAL_MAX_INT32);
816 sal_Int32
n =
static_cast< sal_Int32
>(method_.exceptions.size());
818 css::uno::Reference< css::reflection::XTypeDescription > > s(n);
819 auto r = asNonConstRange(s);
820 for (sal_Int32 i = 0;
i !=
n; ++
i) {
821 r[
i] =
manager_->resolve(method_.exceptions[i]);
829 css::uno::Reference< css::reflection::XInterfaceTypeDescription2 >
830 const & description);
832 BaseOffset(
const BaseOffset&) =
delete;
833 const BaseOffset& operator=(
const BaseOffset&) =
delete;
835 sal_Int32
get()
const {
return offset_; }
839 css::uno::Reference< css::reflection::XInterfaceTypeDescription2 >
840 const & description);
843 css::uno::Reference< css::reflection::XInterfaceTypeDescription2 >
844 const & description);
846 std::set< OUString > set_;
850BaseOffset::BaseOffset(
851 css::uno::Reference< css::reflection::XInterfaceTypeDescription2 >
const &
855 calculateBases(description);
858void BaseOffset::calculateBases(
859 css::uno::Reference< css::reflection::XInterfaceTypeDescription2 >
const &
862 const css::uno::Sequence<
863 css::uno::Reference < css::reflection::XTypeDescription > > bases(
864 description->getBaseTypes());
865 for (
const auto & i : bases) {
867 css::uno::Reference< css::reflection::XInterfaceTypeDescription2 >(
868 resolveTypedefs(css::uno::Any(i)),
869 css::uno::UNO_QUERY_THROW));
873void BaseOffset::calculate(
874 css::uno::Reference< css::reflection::XInterfaceTypeDescription2 >
const &
877 if (set_.insert(description->getName()).second) {
878 calculateBases(description);
879 offset_ += description->getMembers().getLength();
883typedef cppu::ImplInheritanceHelper<
884 PublishableDescription, css::reflection::XInterfaceTypeDescription2 >
885InterfaceTypeDescription_Base;
887class InterfaceTypeDescription:
public InterfaceTypeDescription_Base {
889 InterfaceTypeDescription(
893 InterfaceTypeDescription_Base(entity->isPublished()),
manager_(
manager),
895 { assert(
manager.is()); assert(entity.is()); }
898 virtual ~InterfaceTypeDescription()
override {}
900 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
901 {
return css::uno::TypeClass_INTERFACE; }
903 virtual OUString SAL_CALL getName()
override
906 virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
907 getBaseType()
override {
908 return entity_->getDirectMandatoryBases().empty()
909 ? css::uno::Reference< css::reflection::XTypeDescription >()
910 :
manager_->resolve(entity_->getDirectMandatoryBases()[0].
name);
913 virtual css::uno::Uik SAL_CALL getUik()
override
914 {
return css::uno::Uik(); }
919 css::reflection::XInterfaceMemberTypeDescription > >
920 SAL_CALL getMembers()
override;
924 css::uno::Reference< css::reflection::XTypeDescription > >
925 SAL_CALL getBaseTypes()
override;
929 css::uno::Reference< css::reflection::XTypeDescription > >
930 SAL_CALL getOptionalBaseTypes()
override;
938 css::uno::Reference< css::reflection::XInterfaceMemberTypeDescription > >
939InterfaceTypeDescription::getMembers() {
941 entity_->getDirectAttributes().size() <= SAL_MAX_INT32
942 && (entity_->getDirectMethods().size()
943 <= SAL_MAX_INT32 - entity_->getDirectAttributes().size()));
944 sal_Int32
n1 =
static_cast< sal_Int32
>(
945 entity_->getDirectAttributes().size());
946 sal_Int32
n2 =
static_cast< sal_Int32
>(entity_->getDirectMethods().size());
949 css::reflection::XInterfaceMemberTypeDescription > > s(n1 + n2);
950 auto r = asNonConstRange(s);
951 sal_Int32 off = BaseOffset(
this).get();
952 for (sal_Int32 i = 0;
i !=
n1; ++
i) {
953 r[
i] =
new AttributeDescription(
954 manager_, name_ +
"::" + entity_->getDirectAttributes()[i].name,
955 entity_->getDirectAttributes()[i], off + i);
957 for (sal_Int32 i = 0;
i !=
n2; ++
i) {
958 r[
n1 +
i] =
new MethodDescription(
959 manager_, name_ +
"::" + entity_->getDirectMethods()[i].name,
960 entity_->getDirectMethods()[i], off + n1 + i);
965css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
966InterfaceTypeDescription::getBaseTypes() {
967 assert(entity_->getDirectMandatoryBases().size() <= SAL_MAX_INT32);
968 sal_Int32
n =
static_cast< sal_Int32
>(
969 entity_->getDirectMandatoryBases().size());
971 css::uno::Reference< css::reflection::XTypeDescription > > s(n);
972 auto r = asNonConstRange(s);
973 for (sal_Int32 i = 0;
i !=
n; ++
i) {
974 r[
i] =
manager_->resolve(entity_->getDirectMandatoryBases()[i].name);
979css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
980InterfaceTypeDescription::getOptionalBaseTypes()
982 assert(entity_->getDirectOptionalBases().size() <= SAL_MAX_INT32);
983 sal_Int32
n =
static_cast< sal_Int32
>(
984 entity_->getDirectOptionalBases().size());
986 css::uno::Reference< css::reflection::XTypeDescription > > s(n);
987 auto r = asNonConstRange(s);
988 for (sal_Int32 i = 0;
i !=
n; ++
i) {
989 r[
i] =
manager_->resolve(entity_->getDirectOptionalBases()[i].name);
994class ConstantDescription:
995 public cppu::WeakImplHelper< css::reflection::XConstantTypeDescription >
999 OUString
const & constantGroupName,
1003 virtual ~ConstantDescription()
override {}
1005 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
1006 {
return css::uno::TypeClass_CONSTANT; }
1008 virtual OUString SAL_CALL getName()
override
1011 virtual css::uno::Any SAL_CALL getConstantValue()
override
1018ConstantDescription::ConstantDescription(
1019 OUString
const & constantGroupName,
1021 name_(makePrefix(constantGroupName) + member.
name)
1055 for (;;) { std::abort(); }
1059typedef cppu::ImplInheritanceHelper<
1060 PublishableDescription, css::reflection::XConstantsTypeDescription >
1061ConstantGroupDescription_Base;
1063class ConstantGroupDescription:
public ConstantGroupDescription_Base {
1065 ConstantGroupDescription(
1068 ConstantGroupDescription_Base(entity->isPublished()),
name_(
std::move(
name)),
1070 { assert(entity.is()); }
1073 virtual ~ConstantGroupDescription()
override {}
1075 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
1076 {
return css::uno::TypeClass_CONSTANTS; }
1078 virtual OUString SAL_CALL getName()
override
1083 css::uno::Reference< css::reflection::XConstantTypeDescription > >
1084 SAL_CALL getConstants()
override;
1091 css::uno::Reference< css::reflection::XConstantTypeDescription > >
1092ConstantGroupDescription::getConstants() {
1093 assert(entity_->getMembers().size() <= SAL_MAX_INT32);
1094 sal_Int32
n =
static_cast< sal_Int32
>(entity_->getMembers().size());
1096 css::uno::Reference< css::reflection::XConstantTypeDescription > > s(n);
1097 auto r = asNonConstRange(s);
1098 for (sal_Int32 i = 0;
i !=
n; ++
i) {
1099 r[
i] =
new ConstantDescription(name_, entity_->getMembers()[i]);
1104typedef cppu::ImplInheritanceHelper<
1105 PublishableDescription, css::reflection::XIndirectTypeDescription >
1106TypedefDescription_Base;
1108class TypedefDescription:
public TypedefDescription_Base {
1116 { assert(
manager.is()); assert(entity.is()); }
1119 virtual ~TypedefDescription()
override {}
1121 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
1122 {
return css::uno::TypeClass_TYPEDEF; }
1124 virtual OUString SAL_CALL getName()
override
1127 virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
1128 getReferencedType()
override
1129 {
return manager_->resolve(entity_->getType()); }
1136class ConstructorParameter:
1137 public cppu::WeakImplHelper< css::reflection::XParameter >
1140 ConstructorParameter(
1143 sal_Int32 position):
1148 virtual ~ConstructorParameter()
override {}
1150 virtual OUString SAL_CALL getName()
override
1151 {
return parameter_.name; }
1153 virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
1155 {
return manager_->resolve(parameter_.type); }
1157 virtual sal_Bool SAL_CALL isIn()
override
1160 virtual sal_Bool SAL_CALL isOut()
override
1163 virtual sal_Int32 SAL_CALL getPosition()
override
1164 {
return position_; }
1166 virtual sal_Bool SAL_CALL isRestParameter()
override
1167 {
return parameter_.rest; }
1172 sal_Int32 position_;
1175class ConstructorDescription:
1176 public cppu::WeakImplHelper<
1177 css::reflection::XServiceConstructorDescription >
1180 ConstructorDescription(
1187 virtual ~ConstructorDescription()
override {}
1189 virtual sal_Bool SAL_CALL isDefaultConstructor()
override
1190 {
return constructor_.defaultConstructor; }
1192 virtual OUString SAL_CALL getName()
override
1193 {
return constructor_.name; }
1197 css::uno::Reference< css::reflection::XParameter > >
1198 SAL_CALL getParameters()
override;
1202 css::uno::Reference< css::reflection::XCompoundTypeDescription > >
1203 SAL_CALL getExceptions()
override;
1209css::uno::Sequence< css::uno::Reference< css::reflection::XParameter > >
1210ConstructorDescription::getParameters() {
1211 assert(constructor_.parameters.size() <= SAL_MAX_INT32);
1212 sal_Int32
n =
static_cast< sal_Int32
>(constructor_.parameters.size());
1213 css::uno::Sequence< css::uno::Reference< css::reflection::XParameter > > s(
1215 auto r = asNonConstRange(s);
1216 for (sal_Int32 i = 0;
i !=
n; ++
i) {
1217 r[
i] =
new ConstructorParameter(
1218 manager_, constructor_.parameters[i], i);
1224 css::uno::Reference< css::reflection::XCompoundTypeDescription > >
1225ConstructorDescription::getExceptions() {
1226 assert(constructor_.exceptions.size() <= SAL_MAX_INT32);
1227 sal_Int32
n =
static_cast< sal_Int32
>(constructor_.exceptions.size());
1229 css::uno::Reference< css::reflection::XCompoundTypeDescription > > s(n);
1230 auto r = asNonConstRange(s);
1231 for (sal_Int32 i = 0;
i !=
n; ++
i) {
1233 manager_->resolve(constructor_.exceptions[i]),
1234 css::uno::UNO_QUERY_THROW);
1239typedef cppu::ImplInheritanceHelper<
1240 PublishableDescription, css::reflection::XServiceTypeDescription2 >
1241SingleInterfaceBasedServiceDescription_Base;
1243class SingleInterfaceBasedServiceDescription:
1244 public SingleInterfaceBasedServiceDescription_Base
1247 SingleInterfaceBasedServiceDescription(
1252 SingleInterfaceBasedServiceDescription_Base(entity->isPublished()),
1254 { assert(
manager.is()); assert(entity.is()); }
1257 virtual ~SingleInterfaceBasedServiceDescription()
override {}
1259 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
1260 {
return css::uno::TypeClass_SERVICE; }
1262 virtual OUString SAL_CALL getName()
override
1267 css::uno::Reference< css::reflection::XServiceTypeDescription > >
1268 SAL_CALL getMandatoryServices()
override
1270 return css::uno::Sequence<
1271 css::uno::Reference< css::reflection::XServiceTypeDescription > >();
1276 css::uno::Reference< css::reflection::XServiceTypeDescription > >
1277 SAL_CALL getOptionalServices()
override
1279 return css::uno::Sequence<
1280 css::uno::Reference< css::reflection::XServiceTypeDescription > >();
1285 css::uno::Reference< css::reflection::XInterfaceTypeDescription > >
1286 SAL_CALL getMandatoryInterfaces()
override
1288 return css::uno::Sequence<
1289 css::uno::Reference<
1290 css::reflection::XInterfaceTypeDescription > >();
1295 css::uno::Reference< css::reflection::XInterfaceTypeDescription > >
1296 SAL_CALL getOptionalInterfaces()
override
1298 return css::uno::Sequence<
1299 css::uno::Reference<
1300 css::reflection::XInterfaceTypeDescription > >();
1305 css::uno::Reference< css::reflection::XPropertyTypeDescription > >
1306 SAL_CALL getProperties()
override
1308 return css::uno::Sequence<
1309 css::uno::Reference<
1310 css::reflection::XPropertyTypeDescription > >();
1313 virtual sal_Bool SAL_CALL isSingleInterfaceBased()
override
1316 virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
1317 getInterface()
override
1318 {
return manager_->resolve(entity_->getBase()); }
1322 css::uno::Reference< css::reflection::XServiceConstructorDescription > >
1323 SAL_CALL getConstructors()
override;
1331 css::uno::Reference< css::reflection::XServiceConstructorDescription > >
1332SingleInterfaceBasedServiceDescription::getConstructors()
1334 assert(entity_->getConstructors().size() <= SAL_MAX_INT32);
1335 sal_Int32
n =
static_cast< sal_Int32
>(entity_->getConstructors().size());
1337 css::uno::Reference< css::reflection::XServiceConstructorDescription > >
1339 auto r = asNonConstRange(s);
1340 for (sal_Int32 i = 0;
i !=
n; ++
i) {
1341 r[
i] =
new ConstructorDescription(
1342 manager_, entity_->getConstructors()[i]);
1347class PropertyDescription:
1348 public cppu::WeakImplHelper< css::reflection::XPropertyTypeDescription >
1351 PropertyDescription(
1358 virtual ~PropertyDescription()
override {}
1360 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
1361 {
return css::uno::TypeClass_PROPERTY; }
1363 virtual OUString SAL_CALL getName()
override
1364 {
return property_.name; }
1366 virtual sal_Int16 SAL_CALL getPropertyFlags()
override
1367 {
return property_.attributes; }
1369 virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
1370 getPropertyTypeDescription()
override
1371 {
return manager_->resolve(property_.type); }
1377typedef cppu::ImplInheritanceHelper<
1378 PublishableDescription, css::reflection::XServiceTypeDescription2 >
1379AccumulationBasedServiceDescription_Base;
1381class AccumulationBasedServiceDescription:
1382 public AccumulationBasedServiceDescription_Base
1385 AccumulationBasedServiceDescription(
1390 AccumulationBasedServiceDescription_Base(entity->isPublished()),
1392 { assert(
manager.is()); assert(entity.is()); }
1395 virtual ~AccumulationBasedServiceDescription()
override {}
1397 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
1398 {
return css::uno::TypeClass_SERVICE; }
1400 virtual OUString SAL_CALL getName()
override
1405 css::uno::Reference< css::reflection::XServiceTypeDescription > >
1406 SAL_CALL getMandatoryServices()
override;
1410 css::uno::Reference< css::reflection::XServiceTypeDescription > >
1411 SAL_CALL getOptionalServices()
override;
1415 css::uno::Reference< css::reflection::XInterfaceTypeDescription > >
1416 SAL_CALL getMandatoryInterfaces()
override;
1420 css::uno::Reference< css::reflection::XInterfaceTypeDescription > >
1421 SAL_CALL getOptionalInterfaces()
override;
1425 css::uno::Reference< css::reflection::XPropertyTypeDescription > >
1426 SAL_CALL getProperties()
override;
1428 virtual sal_Bool SAL_CALL isSingleInterfaceBased()
override
1431 virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
1432 getInterface()
override
1433 {
return css::uno::Reference< css::reflection::XTypeDescription >(); }
1437 css::uno::Reference< css::reflection::XServiceConstructorDescription > >
1438 SAL_CALL getConstructors()
override
1440 return css::uno::Sequence<
1441 css::uno::Reference<
1442 css::reflection::XServiceConstructorDescription > >();
1451 css::uno::Reference< css::reflection::XServiceTypeDescription > >
1452AccumulationBasedServiceDescription::getMandatoryServices()
1454 assert(entity_->getDirectMandatoryBaseServices().size() <= SAL_MAX_INT32);
1455 sal_Int32
n =
static_cast< sal_Int32
>(
1456 entity_->getDirectMandatoryBaseServices().size());
1458 css::uno::Reference< css::reflection::XServiceTypeDescription > > s(n);
1459 auto r = asNonConstRange(s);
1460 for (sal_Int32 i = 0;
i !=
n; ++
i) {
1463 entity_->getDirectMandatoryBaseServices()[i].name),
1464 css::uno::UNO_QUERY_THROW);
1470 css::uno::Reference< css::reflection::XServiceTypeDescription > >
1471AccumulationBasedServiceDescription::getOptionalServices()
1473 assert(entity_->getDirectOptionalBaseServices().size() <= SAL_MAX_INT32);
1474 sal_Int32
n =
static_cast< sal_Int32
>(
1475 entity_->getDirectOptionalBaseServices().size());
1477 css::uno::Reference< css::reflection::XServiceTypeDescription > > s(n);
1478 auto r = asNonConstRange(s);
1479 for (sal_Int32 i = 0;
i !=
n; ++
i) {
1481 manager_->resolve(entity_->getDirectOptionalBaseServices()[i].name),
1482 css::uno::UNO_QUERY_THROW);
1488 css::uno::Reference< css::reflection::XInterfaceTypeDescription > >
1489AccumulationBasedServiceDescription::getMandatoryInterfaces()
1491 assert(entity_->getDirectMandatoryBaseInterfaces().size() <= SAL_MAX_INT32);
1492 sal_Int32
n =
static_cast< sal_Int32
>(
1493 entity_->getDirectMandatoryBaseInterfaces().size());
1495 css::uno::Reference< css::reflection::XInterfaceTypeDescription > > s(
1497 auto r = asNonConstRange(s);
1498 for (sal_Int32 i = 0;
i !=
n; ++
i) {
1502 entity_->getDirectMandatoryBaseInterfaces()[i].name)),
1503 css::uno::UNO_QUERY_THROW);
1509 css::uno::Reference< css::reflection::XInterfaceTypeDescription > >
1510AccumulationBasedServiceDescription::getOptionalInterfaces()
1512 assert(entity_->getDirectOptionalBaseInterfaces().size() <= SAL_MAX_INT32);
1513 sal_Int32
n =
static_cast< sal_Int32
>(
1514 entity_->getDirectOptionalBaseInterfaces().size());
1516 css::uno::Reference< css::reflection::XInterfaceTypeDescription > > s(
1518 auto r = asNonConstRange(s);
1519 for (sal_Int32 i = 0;
i !=
n; ++
i) {
1523 entity_->getDirectOptionalBaseInterfaces()[i].name)),
1524 css::uno::UNO_QUERY_THROW);
1530 css::uno::Reference< css::reflection::XPropertyTypeDescription > >
1531AccumulationBasedServiceDescription::getProperties()
1533 assert(entity_->getDirectProperties().size() <= SAL_MAX_INT32);
1534 sal_Int32
n =
static_cast< sal_Int32
>(
1535 entity_->getDirectProperties().size());
1537 css::uno::Reference< css::reflection::XPropertyTypeDescription > > s(n);
1538 auto r = asNonConstRange(s);
1539 for (sal_Int32 i = 0;
i !=
n; ++
i) {
1540 r[
i] =
new PropertyDescription(
1541 manager_, entity_->getDirectProperties()[i]);
1546typedef cppu::ImplInheritanceHelper<
1547 PublishableDescription, css::reflection::XSingletonTypeDescription2 >
1548InterfaceBasedSingletonDescription_Base;
1550class InterfaceBasedSingletonDescription:
1551 public InterfaceBasedSingletonDescription_Base
1554 InterfaceBasedSingletonDescription(
1558 InterfaceBasedSingletonDescription_Base(entity->isPublished()),
1560 { assert(
manager.is()); assert(entity.is()); }
1563 virtual ~InterfaceBasedSingletonDescription()
override {}
1565 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
1566 {
return css::uno::TypeClass_SINGLETON; }
1568 virtual OUString SAL_CALL getName()
override
1571 virtual css::uno::Reference< css::reflection::XServiceTypeDescription >
1572 SAL_CALL getService()
override
1575 css::uno::Reference< css::reflection::XServiceTypeDescription >();
1578 virtual sal_Bool SAL_CALL isInterfaceBased()
override
1581 virtual css::uno::Reference< css::reflection::XTypeDescription >
1582 SAL_CALL getInterface()
override
1583 {
return manager_->resolve(entity_->getBase()); }
1590typedef cppu::ImplInheritanceHelper<
1591 PublishableDescription, css::reflection::XSingletonTypeDescription2 >
1592ServiceBasedSingletonDescription_Base;
1594class ServiceBasedSingletonDescription:
1595 public ServiceBasedSingletonDescription_Base
1598 ServiceBasedSingletonDescription(
1602 ServiceBasedSingletonDescription_Base(entity->isPublished()),
1604 { assert(
manager.is()); assert(entity.is()); }
1607 virtual ~ServiceBasedSingletonDescription()
override {}
1609 virtual css::uno::TypeClass SAL_CALL
getTypeClass()
override
1610 {
return css::uno::TypeClass_SINGLETON; }
1612 virtual OUString SAL_CALL getName()
override
1615 virtual css::uno::Reference< css::reflection::XServiceTypeDescription >
1616 SAL_CALL getService()
override
1618 return css::uno::Reference< css::reflection::XServiceTypeDescription >(
1619 manager_->resolve(entity_->getBase()), css::uno::UNO_QUERY_THROW);
1622 virtual sal_Bool SAL_CALL isInterfaceBased()
override
1625 virtual css::uno::Reference< css::reflection::XTypeDescription >
1626 SAL_CALL getInterface()
override
1627 {
return css::uno::Reference< css::reflection::XTypeDescription >(); }
1635 public cppu::WeakImplHelper< css::reflection::XTypeDescriptionEnumeration >
1640 OUString
const & prefix,
1642 css::uno::Sequence< css::uno::TypeClass >
const & types,
bool deep):
1646 positions_.push(
Position(prefix, cursor));
1654 {
return !positions_.empty(); }
1656 virtual css::uno::Any SAL_CALL
nextElement()
override
1657 {
return css::uno::Any(nextTypeDescription()); }
1659 virtual css::uno::Reference< css::reflection::XTypeDescription > SAL_CALL
1660 nextTypeDescription()
override;
1662 bool matches(css::uno::TypeClass tc)
const;
1664 void findNextMatch();
1670 prefix(
std::move(thePrefix)), cursor(theCursor)
1671 { assert(theCursor.is()); }
1677 prefix(
std::move(thePrefix)), constantGroup(theConstantGroup),
1678 constantGroupIndex(constantGroup->getMembers().
begin())
1679 { assert(theConstantGroup.is()); }
1683 constantGroup(other.constantGroup)
1685 if (constantGroup.is()) {
1686 constantGroupIndex = other.constantGroupIndex;
1693 std::vector< unoidl::ConstantGroupEntity::Member >::const_iterator
1698 css::uno::Sequence< css::uno::TypeClass > types_;
1702 std::stack< Position, std::vector<Position> > positions_;
1706css::uno::Reference< css::reflection::XTypeDescription >
1707Enumeration::nextTypeDescription()
1711 std::scoped_lock g(mutex_);
1712 if (positions_.empty()) {
1713 throw css::container::NoSuchElementException(
1714 "exhausted XTypeDescriptionEnumeration",
1723bool Enumeration::matches(css::uno::TypeClass tc)
const {
1724 if (!types_.hasElements()) {
1728 return std::any_of(types_.begin(), types_.end(), [&tc](
const auto& i) { return i == tc; });
1731void Enumeration::findNextMatch() {
1734 assert(!positions_.empty());
1736 if (positions_.top().cursor.is()) {
1738 positions_.top().cursor->getNext(&name));
1741 if (positions_.empty()) {
1746 name = positions_.top().prefix +
name;
1747 css::uno::TypeClass tc;
1748 switch (ent->getSort()) {
1750 tc = css::uno::TypeClass_MODULE;
1760 tc = css::uno::TypeClass_ENUM;
1764 tc = css::uno::TypeClass_STRUCT;
1767 tc = css::uno::TypeClass_EXCEPTION;
1770 tc = css::uno::TypeClass_INTERFACE;
1773 tc = css::uno::TypeClass_TYPEDEF;
1776 tc = css::uno::TypeClass_CONSTANTS;
1777 if (deep_ && matches(css::uno::TypeClass_CONSTANT)) {
1787 tc = css::uno::TypeClass_SERVICE;
1791 tc = css::uno::TypeClass_SINGLETON;
1794 for (;;) { std::abort(); }
1801 if (positions_.top().constantGroupIndex
1802 == positions_.top().constantGroup->getMembers().end())
1805 if (positions_.empty()) {
1810 current_ = positions_.top().prefix
1811 + positions_.top().constantGroupIndex++->name;
1816 throw css::uno::DeploymentException(
1830 static constexpr std::pair<std::u16string_view, css::uno::TypeClass>
const simple[] = {
1831 {
u"void", css::uno::TypeClass_VOID },
1832 {
u"boolean", css::uno::TypeClass_BOOLEAN },
1833 {
u"byte", css::uno::TypeClass_BYTE },
1834 {
u"short", css::uno::TypeClass_SHORT },
1835 {
u"unsigned short", css::uno::TypeClass_UNSIGNED_SHORT },
1836 {
u"long", css::uno::TypeClass_LONG },
1837 {
u"unsigned long", css::uno::TypeClass_UNSIGNED_LONG },
1838 {
u"hyper", css::uno::TypeClass_HYPER },
1839 {
u"unsigned hyper", css::uno::TypeClass_UNSIGNED_HYPER },
1840 {
u"float", css::uno::TypeClass_FLOAT },
1841 {
u"double", css::uno::TypeClass_DOUBLE },
1842 {
u"char", css::uno::TypeClass_CHAR },
1843 {
u"string", css::uno::TypeClass_STRING },
1844 {
u"type", css::uno::TypeClass_TYPE },
1845 {
u"any", css::uno::TypeClass_ANY } };
1846 for (
const auto& [ rName, rTypeClass ] : simple) {
1847 if (
name == rName) {
1848 return css::uno::Any(
1849 css::uno::Reference< css::reflection::XTypeDescription >(
1850 new SimpleTypeDescription(rTypeClass,
name)));
1853 if (
name.startsWith(
"[]")) {
1854 return getSequenceType(
name);
1856 sal_Int32
i =
name.indexOf(
'<');
1858 return getInstantiatedStruct(
name,
i);
1860 i =
name.indexOf(
"::");
1862 return getInterfaceMember(
name,
i);
1866 return getNamed(
name, ent);
1868 i =
name.lastIndexOf(
'.');
1870 OUString parent(
name.copy(0,
i));
1871 ent = findEntity(parent);
1873 switch (ent->getSort()) {
1875 return getEnumMember(
1877 name.subView(
i + 1));
1882 name.subView(
i + 1));
1888 return css::uno::Any();
1891css::uno::Reference< css::reflection::XTypeDescription >
1893 css::uno::Reference< css::reflection::XTypeDescription > desc(
1896 throw css::uno::DeploymentException(
1897 "cannot resolve type \"" +
name +
"\"",
1908 "com.sun.star.comp.cppuhelper.bootstrap.TypeManager";
1912 OUString
const & ServiceName)
1917css::uno::Sequence< OUString >
1920 return {
"com.sun.star.reflection.TypeDescriptionManager" };
1924 OUString
const & aName)
1927 if (!desc.hasValue()) {
1928 throw css::container::NoSuchElementException(
1935 OUString
const & aName)
1947 throw css::uno::RuntimeException(
1948 "TypeManager hasElements: method not supported",
1952css::uno::Reference< css::container::XEnumeration >
1955 throw css::uno::RuntimeException(
1956 "TypeManager createEnumeration: method not supported",
1962 throw css::uno::RuntimeException(
1963 "TypeManager has: method not supported",
1970 if (!(aElement >>= uri)) {
1971 throw css::lang::IllegalArgumentException(
1972 (
"css.uno.theTypeDescriptionManager.insert expects a string URI"
1978 readRdbFile(uri,
false);
1984 if (!(aElement >>= uri)) {
1985 throw css::lang::IllegalArgumentException(
1986 (
"css.uno.theTypeDescriptionManager.remove expects a string URI"
1993css::uno::Reference< css::reflection::XTypeDescriptionEnumeration >
1995 OUString
const & moduleName,
1996 css::uno::Sequence< css::uno::TypeClass >
const & types,
1997 css::reflection::TypeDescriptionSearchDepth depth)
2001 cursor =
manager_->createCursor(moduleName);
2003 throw css::uno::DeploymentException(
2004 (
"unoidl::FileFormatException for <" + e.
getUri() +
">: "
2011 throw css::reflection::NoSuchTypeNameException(
2015 this, makePrefix(moduleName), cursor, types,
2016 depth == css::reflection::TypeDescriptionSearchDepth_INFINITE);
2020 for (sal_Int32
i = 0;
i != -1;) {
2029 readRdbDirectory(uri, optional);
2031 readRdbFile(uri, optional);
2037 std::u16string_view uri,
bool optional)
2039 osl::Directory dir = OUString(uri);
2040 switch (dir.open()) {
2041 case osl::FileBase::E_None:
2043 case osl::FileBase::E_NOENT:
2045 SAL_INFO(
"cppuhelper",
"Ignored optional " << OUString(uri));
2050 throw css::uno::DeploymentException(
2051 OUString::Concat(
"Cannot open directory ") + uri,
2059 readRdbFile(url,
false);
2064 std::u16string_view uri,
bool optional)
2067 manager_->addProvider(OUString(uri));
2070 throw css::uno::DeploymentException(
2071 OUString::Concat(uri) +
": no such file",
2074 SAL_INFO(
"cppuhelper",
"Ignored optional " << OUString(uri));
2076 throw css::uno::DeploymentException(
2077 (
"unoidl::FileFormatException for <" + e.
getUri() +
">: "
2084 OUString
const & name)
2086 assert(
name.startsWith(
"[]"));
2087 return css::uno::Any(
2088 css::uno::Reference< css::reflection::XTypeDescription >(
2089 new SequenceTypeDescription(
2090 this,
name,
name.copy(std::strlen(
"[]")))));
2094 OUString
const & name, sal_Int32 separator)
2102 return css::uno::Any();
2107 std::vector< OUString >
args;
2112 for (sal_Int32 level = 0; j !=
name.getLength(); ++j) {
2118 }
else if (c ==
'<') {
2120 }
else if (c ==
'>') {
2127 if (j !=
name.getLength()) {
2131 }
while (
i !=
name.getLength() &&
name[
i] !=
'>');
2132 if (
i !=
name.getLength() - 1 ||
name[
i] !=
'>'
2133 ||
args.size() != ent2->getTypeParameters().size())
2135 return css::uno::Any();
2137 return css::uno::Any(
2138 css::uno::Reference< css::reflection::XTypeDescription >(
2139 new InstantiatedPolymorphicStructTypeDescription(
2140 this,
name, ent2, std::move(
args))));
2144 std::u16string_view name, std::size_t separator)
2147 css::uno::Reference< css::reflection::XInterfaceTypeDescription2 > ifc(
2148 resolveTypedefs(
find(OUString(
name.substr(0,
separator)))), css::uno::UNO_QUERY);
2150 return css::uno::Any();
2152 std::u16string_view member =
name.substr(
separator + std::strlen(
"::"));
2153 const css::uno::Sequence<
2154 css::uno::Reference<
2155 css::reflection::XInterfaceMemberTypeDescription > > mems(
2157 for (
const auto &
m : mems) {
2158 if (
m->getMemberName() == member) {
2159 return css::uno::Any(
2160 css::uno::Reference< css::reflection::XTypeDescription >(
m));
2163 return css::uno::Any();
2169 assert(entity.is());
2170 switch (entity->getSort()) {
2172 return css::uno::Any(
2173 css::uno::Reference< css::reflection::XTypeDescription >(
2174 new ModuleDescription(
2178 return css::uno::Any(
2179 css::uno::Reference< css::reflection::XTypeDescription >(
2180 new EnumTypeDescription(
2184 return css::uno::Any(
2185 css::uno::Reference< css::reflection::XTypeDescription >(
2186 new PlainStructTypeDescription(
2191 return css::uno::Any(
2192 css::uno::Reference< css::reflection::XTypeDescription >(
2193 new PolymorphicStructTypeTemplateDescription(
2199 return css::uno::Any(
2200 css::uno::Reference< css::reflection::XTypeDescription >(
2201 new ExceptionTypeDescription(
2206 return css::uno::Any(
2207 css::uno::Reference< css::reflection::XTypeDescription >(
2208 new InterfaceTypeDescription(
2213 return css::uno::Any(
2214 css::uno::Reference< css::reflection::XTypeDescription >(
2215 new TypedefDescription(
2219 return css::uno::Any(
2220 css::uno::Reference< css::reflection::XTypeDescription >(
2221 new ConstantGroupDescription(
2226 return css::uno::Any(
2227 css::uno::Reference< css::reflection::XTypeDescription >(
2228 new SingleInterfaceBasedServiceDescription(
2233 return css::uno::Any(
2234 css::uno::Reference< css::reflection::XTypeDescription >(
2235 new AccumulationBasedServiceDescription(
2240 return css::uno::Any(
2241 css::uno::Reference< css::reflection::XTypeDescription >(
2242 new InterfaceBasedSingletonDescription(
2247 return css::uno::Any(
2248 css::uno::Reference< css::reflection::XTypeDescription >(
2249 new ServiceBasedSingletonDescription(
2254 for (;;) { std::abort(); }
2260 std::u16string_view member)
2262 auto i = std::find_if(entity->getMembers().begin(), entity->getMembers().end(),
2264 if (
i != entity->getMembers().end())
2265 return css::uno::Any(
i->value);
2266 return css::uno::Any();
2270 std::u16string_view constantGroupName,
2272 std::u16string_view member)
2274 auto i = std::find_if(entity->getMembers().begin(), entity->getMembers().end(),
2276 if (
i != entity->getMembers().end())
2277 return css::uno::Any(
2278 css::uno::Reference< css::reflection::XTypeDescription >(
2279 new ConstantDescription(OUString(constantGroupName), *
i)));
2280 return css::uno::Any();
2284 OUString
const & name)
2289 throw css::uno::DeploymentException(
2290 (
"unoidl::FileFormatException for <" + e.
getUri() +
">: "
virtual css::uno::Any SAL_CALL nextElement() override
Enumeration(css::container::XIndexAccess *)
virtual sal_Bool SAL_CALL hasMoreElements() override
Base class to implement a UNO object supporting weak references, i.e.
css::uno::Type const & get()
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL hasElements() override
static css::uno::Any getEnumMember(rtl::Reference< unoidl::EnumTypeEntity > const &entity, std::u16string_view member)
virtual void SAL_CALL remove(css::uno::Any const &aElement) override
virtual css::uno::Reference< css::reflection::XTypeDescriptionEnumeration > SAL_CALL createTypeDescriptionEnumeration(OUString const &moduleName, css::uno::Sequence< css::uno::TypeClass > const &types, css::reflection::TypeDescriptionSearchDepth depth) override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
virtual css::uno::Any SAL_CALL getByHierarchicalName(OUString const &aName) override
css::uno::Reference< css::reflection::XTypeDescription > resolve(OUString const &name)
virtual sal_Bool SAL_CALL has(css::uno::Any const &aElement) override
css::uno::Any find(OUString const &name)
virtual ~TypeManager() noexcept override
rtl::Reference< unoidl::Entity > findEntity(OUString const &name)
virtual void SAL_CALL insert(css::uno::Any const &aElement) override
void readRdbDirectory(std::u16string_view uri, bool optional)
css::uno::Any getNamed(OUString const &name, rtl::Reference< unoidl::Entity > const &entity)
css::uno::Any getInterfaceMember(std::u16string_view name, std::size_t separator)
css::uno::Any getInstantiatedStruct(OUString const &name, sal_Int32 separator)
virtual sal_Bool SAL_CALL supportsService(OUString const &ServiceName) override
virtual css::uno::Type SAL_CALL getElementType() override
css::uno::Any getSequenceType(OUString const &name)
void init(std::u16string_view rdbUris)
void readRdbFile(std::u16string_view uri, bool optional)
virtual sal_Bool SAL_CALL hasByHierarchicalName(OUString const &aName) override
static css::uno::Any getConstant(std::u16string_view constantGroupName, rtl::Reference< unoidl::ConstantGroupEntity > const &entity, std::u16string_view member)
SORT_ACCUMULATION_BASED_SERVICE
SORT_SINGLE_INTERFACE_BASED_SERVICE
SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE
SORT_INTERFACE_BASED_SINGLETON
SORT_SERVICE_BASED_SINGLETON
virtual rtl::Reference< MapCursor > createCursor() const=0
rtl::Reference< ParseManager > manager
rtl::Reference< Manager > manager_
#define SAL_INFO(area, stream)
OSQLColumns::const_iterator find(const OSQLColumns::const_iterator &first, const OSQLColumns::const_iterator &last, std::u16string_view _rVal, const ::comphelper::UStringMixEqual &_rCase)
void decodeRdbUri(std::u16string_view *uri, bool *optional, bool *directory)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
A helper for implementations of com.sun.star.lang.XServiceInfo.
bool nextDirectoryItem(osl::Directory &directory, OUString *url)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
enumrange< T >::Iterator begin(enumrange< T >)
PyRef getTypeClass(const Runtime &)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
bool getType(BSTR name, Type &type)
sal_uInt16 unsignedShortValue
sal_uInt64 unsignedHyperValue
sal_uInt32 unsignedLongValue