1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/config.h>
22 #include <codemaker/codemaker.hxx>
23 #include <codemaker/commoncpp.hxx>
24 #include <codemaker/global.hxx>
26 #include "skeletoncommon.hxx"
27 #include "skeletoncpp.hxx"
30 #include <string_view>
32 using namespace ::codemaker::cpp
;
34 namespace skeletonmaker::cpp
{
36 static void printType(
37 std::ostream
& o
, ProgramOptions
const & options
,
38 rtl::Reference
< TypeManager
> const & manager
,
39 codemaker::UnoType::Sort sort
, std::u16string_view nucleus
, sal_Int32 rank
,
40 std::vector
< OUString
> const & arguments
,
41 rtl::Reference
< unoidl::Entity
> const & entity
, short referenceType
,
44 if (defaultvalue
&& rank
== 0 && sort
<= codemaker::UnoType::Sort::Char
) {
46 case codemaker::UnoType::Sort::Boolean
:
49 case codemaker::UnoType::Sort::Char
:
50 case codemaker::UnoType::Sort::Byte
:
51 case codemaker::UnoType::Sort::Short
:
52 case codemaker::UnoType::Sort::UnsignedShort
:
53 case codemaker::UnoType::Sort::Long
:
54 case codemaker::UnoType::Sort::UnsignedLong
:
55 case codemaker::UnoType::Sort::Hyper
:
56 case codemaker::UnoType::Sort::UnsignedHyper
:
57 case codemaker::UnoType::Sort::Float
:
58 case codemaker::UnoType::Sort::Double
:
66 if (defaultvalue
&& referenceType
== 16) {
67 if (sort
== codemaker::UnoType::Sort::Enum
) {
68 auto pEnumTypeEntity(dynamic_cast<unoidl::EnumTypeEntity
*>(entity
.get()));
69 assert(pEnumTypeEntity
);
70 o
<< OUString(nucleus
.substr(nucleus
.rfind('.') + 1)) << "_"
71 << pEnumTypeEntity
->getMembers()[0].name
;
75 bool bReference
= false;
76 if (((sort
> codemaker::UnoType::Sort::Char
||
77 rank
> 0) && referenceType
!= 8 &&
78 !(sort
== codemaker::UnoType::Sort::Enum
&& referenceType
== 4 && rank
== 0)) ||
79 (sort
<= codemaker::UnoType::Sort::Char
&& referenceType
== 2))
84 if (bReference
&& referenceType
== 4)
87 for (sal_Int32 i
= 0; i
< rank
; ++i
) {
88 o
<< ((options
.shortnames
) ? "css::uno::Sequence< " :
89 "::com::sun::star::uno::Sequence< ");
91 if (sort
== codemaker::UnoType::Sort::Interface
&& referenceType
> 0) {
92 o
<< ((options
.shortnames
) ? "css::uno::Reference< " :
93 "::com::sun::star::uno::Reference< ");
96 o
<< scopedCppName(codemaker::cpp::translateUnoToCppType(sort
, nucleus
),
97 options
.shortnames
&& referenceType
> 0);
99 if (sort
== codemaker::UnoType::Sort::Interface
&& referenceType
> 0)
102 if (!arguments
.empty()) {
104 for (std::vector
< OUString
>::const_iterator
i(arguments
.begin());
105 i
!= arguments
.end(); ++i
)
107 if (i
!= arguments
.begin())
110 printType(o
, options
, manager
, *i
, 1);
115 for (sal_Int32 i
= 0; i
< rank
; ++i
)
118 if (bReference
&& referenceType
> 1)
121 if (referenceType
== 8 && (sort
> codemaker::UnoType::Sort::Char
|| rank
> 0))
126 std::ostream
& o
, ProgramOptions
const & options
,
127 rtl::Reference
< TypeManager
> const & manager
, std::u16string_view name
,
128 short referenceType
, bool defaultvalue
)
132 std::vector
< OUString
> arguments
;
133 rtl::Reference
< unoidl::Entity
> entity
;
134 codemaker::UnoType::Sort sort
= manager
->decompose(
135 name
, true, &nucleus
, &rank
, &arguments
, &entity
);
137 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, entity
,
138 referenceType
, defaultvalue
);
141 static bool printConstructorParameters(
142 std::ostream
& o
, ProgramOptions
const & options
,
143 rtl::Reference
< TypeManager
> const & manager
,
144 codemaker::UnoType::Sort sort
,
145 rtl::Reference
< unoidl::Entity
> const & entity
, std::u16string_view name
,
146 std::vector
< OUString
> const & arguments
)
148 bool previous
= false;
150 case codemaker::UnoType::Sort::PlainStruct
:
152 rtl::Reference
< unoidl::PlainStructTypeEntity
> ent2(
153 dynamic_cast< unoidl::PlainStructTypeEntity
* >(entity
.get()));
155 if (!ent2
->getDirectBase().isEmpty()) {
156 rtl::Reference
< unoidl::Entity
> baseEnt
;
157 codemaker::UnoType::Sort baseSort
= manager
->getSort(
158 ent2
->getDirectBase(), &baseEnt
);
159 previous
= printConstructorParameters(
160 o
, options
, manager
, baseSort
, baseEnt
,
161 ent2
->getDirectBase(), std::vector
< OUString
>());
163 for (const auto& rMember
: ent2
->getDirectMembers())
169 printType(o
, options
, manager
, rMember
.type
, 4);
171 << codemaker::cpp::translateUnoToCppIdentifier(
172 u2b(rMember
.name
), "param");
176 case codemaker::UnoType::Sort::PolymorphicStructTemplate
:
178 rtl::Reference
< unoidl::PolymorphicStructTypeTemplateEntity
> ent2(
179 dynamic_cast< unoidl::PolymorphicStructTypeTemplateEntity
* >(
182 for (const auto& rMember
: ent2
->getMembers())
188 if (rMember
.parameterized
) {
191 printType(o
, options
, manager
, rMember
.type
, 4);
194 << codemaker::cpp::translateUnoToCppIdentifier(
195 u2b(rMember
.name
), "param");
199 case codemaker::UnoType::Sort::InstantiatedPolymorphicStruct
:
201 rtl::Reference
< unoidl::PolymorphicStructTypeTemplateEntity
> ent2(
202 dynamic_cast< unoidl::PolymorphicStructTypeTemplateEntity
* >(
205 for (const auto& rMember
: ent2
->getMembers())
211 if (rMember
.parameterized
) {
212 auto j
= std::find(ent2
->getTypeParameters().begin(),
213 ent2
->getTypeParameters().end(), rMember
.type
);
214 if (j
!= ent2
->getTypeParameters().end()) {
215 o
<< arguments
[j
- ent2
->getTypeParameters().begin()];
218 printType(o
, options
, manager
, rMember
.type
, 4);
221 << codemaker::cpp::translateUnoToCppIdentifier(
222 u2b(rMember
.name
), "param");
226 case codemaker::UnoType::Sort::Exception
:
228 rtl::Reference
< unoidl::ExceptionTypeEntity
> ent2(
229 dynamic_cast< unoidl::ExceptionTypeEntity
* >(entity
.get()));
231 if (!ent2
->getDirectBase().isEmpty()) {
232 rtl::Reference
< unoidl::Entity
> baseEnt
;
233 codemaker::UnoType::Sort baseSort
= manager
->getSort(
234 ent2
->getDirectBase(), &baseEnt
);
235 previous
= printConstructorParameters(
236 o
, options
, manager
, baseSort
, baseEnt
,
237 ent2
->getDirectBase(), std::vector
< OUString
>());
239 for (const auto& rMember
: ent2
->getDirectMembers())
245 printType(o
, options
, manager
, rMember
.type
, 4);
247 << codemaker::cpp::translateUnoToCppIdentifier(
248 u2b(rMember
.name
), "param");
253 throw CannotDumpException(
254 OUString::Concat("unexpected entity \"") + name
255 + "\" in call to skeletonmaker::cpp::printConstructorParameters");
260 static void printConstructor(
261 std::ostream
& o
, ProgramOptions
const & options
,
262 rtl::Reference
< TypeManager
> const & manager
,
263 codemaker::UnoType::Sort sort
,
264 rtl::Reference
< unoidl::Entity
> const & entity
, std::u16string_view name
,
265 std::vector
< OUString
> const & arguments
)
267 o
<< "public " << OUString(name
.substr(name
.rfind('.') + 1)) << '(';
268 printConstructorParameters(
269 o
, options
, manager
, sort
, entity
, name
, arguments
);
273 static void printMethodParameters(
274 std::ostream
& o
, ProgramOptions
const & options
,
275 rtl::Reference
< TypeManager
> const & manager
,
276 std::vector
< unoidl::InterfaceTypeEntity::Method::Parameter
> const &
280 for (std::vector
< unoidl::InterfaceTypeEntity::Method::Parameter
>::
281 const_iterator
i(parameters
.begin());
282 i
!= parameters
.end(); ++i
)
284 if (i
!= parameters
.begin()) {
290 == unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_IN
)
296 printType(o
, options
, manager
, i
->type
, referenceType
);
299 o
<< codemaker::cpp::translateUnoToCppIdentifier(u2b(i
->name
), "param");
303 static void printExceptionSpecification(
305 ProgramOptions
const & options
,
306 rtl::Reference
< TypeManager
> const & manager
,
307 std::vector
< OUString
> const & exceptions
)
309 o
<< ((options
.shortnames
) ? " throw (css::uno::RuntimeException" :
310 " throw (::com::sun::star::uno::RuntimeException");
311 for (const auto& rException
: exceptions
)
314 printType(o
, options
, manager
, rException
, 1);
319 static void printSetPropertyMixinBody(
320 std::ostream
& o
, unoidl::InterfaceTypeEntity::Attribute
const & attribute
)
322 unoidl::AccumulationBasedServiceEntity::Property::Attributes propFlags
323 = checkAdditionalPropertyFlags(attribute
);
328 o
<< " BoundListeners l;\n";
330 if (propFlags
& unoidl::AccumulationBasedServiceEntity::Property::ATTRIBUTE_CONSTRAINED
) {
331 OString fieldtype
= codemaker::convertString(attribute
.type
);
333 sal_Int32 index
= fieldtype
.lastIndexOf('<');
336 bool optional
= false;
337 OStringBuffer
buffer1(64);
338 OStringBuffer
buffer2(64);
341 OString
s(fieldtype
.getToken(0, '<', nPos
));
342 OString t
= s
.copy(s
.lastIndexOf('/')+1);
344 if (t
== "Optional") {
348 buffer1
.append("the_value.IsPresent");
349 buffer2
.append("the_value.Value");
351 buffer1
.insert(0, t
);
352 buffer1
.append(".IsPresent");
353 buffer2
.insert(0, t
);
354 buffer2
.append(".Value");
360 buffer1
.append("the_value.Value");
362 buffer2
.append("the_value.Value");
365 buffer1
.insert(0, t
);
366 buffer1
.append(".Value");
368 buffer2
.insert(0, t
);
369 buffer2
.append(".Value");
372 } while( nPos
<= index
);
374 o
<< " css::uno::Any v;\n";
376 o
<< " if(" << buffer1
.makeStringAndClear() << ")\n {\n v <<= " << buffer2
.makeStringAndClear() << ";\n }\n";
378 o
<< " v <<= " << buffer2
.makeStringAndClear() << ";\n\n";
381 o
<< " prepareSet(\n OUString(\""
382 << attribute
.name
<< "\"),\n css::uno::Any(), v, ";
384 o
<< " prepareSet(\n OUString(\""
385 << attribute
.name
<< "\"),\n css::uno::Any(), css::uno::Any(), ";
393 o
<< " {\n osl::MutexGuard g(m_aMutex);\n m_"
394 << attribute
.name
<< " = the_value;\n }\n";
397 o
<< " l.notify();\n";
402 void printMethods(std::ostream
& o
,
403 ProgramOptions
const & options
, rtl::Reference
< TypeManager
> const & manager
,
404 OUString
const & name
, codemaker::GeneratedTypeSet
& generated
,
405 OString
const & delegate
, OString
const & classname
,
406 OString
const & indentation
, bool defaultvalue
,
407 OUString
const & propertyhelper
)
409 if (generated
.contains(u2b(name
)) || name
== "com.sun.star.uno.XInterface" ||
411 ( name
== "com.sun.star.lang.XComponent" ||
412 name
== "com.sun.star.lang.XTypeProvider" ||
413 name
== "com.sun.star.uno.XWeak" ) ) )
418 static OString
sd("_"_ostr
);
419 bool body
= !delegate
.isEmpty();
420 bool defaultbody
= delegate
== sd
;
422 if (body
&& propertyhelper
.getLength() > 1) {
423 if (name
== "com.sun.star.beans.XPropertySet") {
424 generated
.add(u2b(name
));
425 generateXPropertySetBodies(
426 o
, classname
, scopedCppName(u2b(propertyhelper
)));
428 } else if (name
== "com.sun.star.beans.XFastPropertySet") {
429 generated
.add(u2b(name
));
430 generateXFastPropertySetBodies(
431 o
, classname
, scopedCppName(u2b(propertyhelper
)));
433 } else if (name
== "com.sun.star.beans.XPropertyAccess") {
434 generated
.add(u2b(name
));
435 generateXPropertyAccessBodies(
436 o
, classname
, scopedCppName(u2b(propertyhelper
)));
441 if (body
&& options
.componenttype
== 2) {
442 if (name
== "com.sun.star.lang.XServiceName") {
443 o
<< "// ::com::sun::star::lang::XServiceName:\n"
444 "OUString SAL_CALL " << classname
<< "getServiceName() "
445 "throw (css::uno::RuntimeException)\n{\n "
447 "sADDIN_SERVICENAME);\n}\n";
448 generated
.add(u2b(name
));
450 } else if (name
== "com.sun.star.sheet.XAddIn") {
451 generateXAddInBodies(o
, classname
);
452 generated
.add(u2b(name
));
454 // special handling of XLocalizable -> parent of XAddIn
455 if (!generated
.contains("com.sun.star.lang.XLocalizable"_ostr
)) {
456 generateXLocalizable(o
, classname
);
457 generated
.add("com.sun.star.lang.XLocalizable"_ostr
);
460 } else if (name
== "com.sun.star.lang.XLocalizable") {
461 generateXLocalizable(o
, classname
);
462 generated
.add(u2b(name
));
464 } else if (name
== "com.sun.star.sheet.XCompatibilityNames") {
465 generateXCompatibilityNamesBodies(o
, classname
);
466 generated
.add(u2b(name
));
471 if (body
&& options
.componenttype
== 3) {
472 if (name
== "com.sun.star.lang.XInitialization") {
473 generateXInitialization(o
, classname
);
474 generated
.add(u2b(name
));
476 } else if (name
== "com.sun.star.frame.XDispatch") {
477 generateXDispatch(o
, classname
, options
.protocolCmdMap
);
478 generated
.add(u2b(name
));
480 } else if (name
== "com.sun.star.frame.XDispatchProvider") {
481 generateXDispatchProvider(o
, classname
, options
.protocolCmdMap
);
482 generated
.add(u2b(name
));
487 generated
.add(u2b(name
));
488 rtl::Reference
< unoidl::Entity
> ent
;
489 if (manager
->getSort(name
, &ent
) != codemaker::UnoType::Sort::Interface
)
491 throw CannotDumpException(
492 "unexpected entity \"" + name
493 + "\" in call to skeletonmaker::cpp::printMethods");
495 rtl::Reference
< unoidl::InterfaceTypeEntity
> ent2(
496 dynamic_cast< unoidl::InterfaceTypeEntity
* >(ent
.get()));
498 if (options
.all
|| defaultvalue
) {
499 for (const auto& rBase
: ent2
->getDirectMandatoryBases())
502 o
, options
, manager
, rBase
.name
, generated
, delegate
, classname
,
503 indentation
, defaultvalue
, propertyhelper
);
505 if (!(ent2
->getDirectAttributes().empty()
506 && ent2
->getDirectMethods().empty()))
508 o
<< indentation
<< "// ";
509 printType(o
, options
, manager
, name
, 0);
513 for (const auto& rAttr
: ent2
->getDirectAttributes())
519 printType(o
, options
, manager
, rAttr
.type
, 1);
521 if (!classname
.isEmpty())
524 o
<< "get" << rAttr
.name
<< "()";
525 printExceptionSpecification(o
, options
, manager
, rAttr
.getExceptions
);
528 if (!propertyhelper
.isEmpty()) {
529 o
<< "\n{\n osl::MutexGuard g(m_aMutex);\n return m_"
530 << rAttr
.name
<< ";\n}\n\n";
532 o
<< "\n{\n return ";
533 if (options
.componenttype
== 1) {
534 o
<< "m_" << rAttr
.name
;
536 printType(o
, options
, manager
, rAttr
.type
, 8, true);
541 o
<< "\n" << indentation
<< "{\n" << indentation
<< " return "
542 << delegate
<< "get" << rAttr
.name
<< "();\n"
543 << indentation
<< "}\n\n";
549 if (!rAttr
.readOnly
) {
554 o
<< "void SAL_CALL ";
555 if (!classname
.isEmpty())
558 o
<< "set" << rAttr
.name
<< '(';
559 printType(o
, options
, manager
, rAttr
.type
, 4);
561 printExceptionSpecification(o
, options
, manager
, rAttr
.setExceptions
);
564 if (!propertyhelper
.isEmpty()) {
565 printSetPropertyMixinBody(o
, rAttr
);
567 if (options
.componenttype
== 1) {
568 o
<< "\n{\n m_" << rAttr
.name
569 << " = the_value;\n}\n\n";
575 o
<< "\n" << indentation
<< "{\n" << indentation
<< " "
576 << delegate
<< "set" << rAttr
.name
577 << "(the_value);\n" << indentation
<< "}\n\n";
584 for (const auto& rMethod
: ent2
->getDirectMethods())
590 printType(o
, options
, manager
, rMethod
.returnType
, 1);
592 if (!classname
.isEmpty())
595 o
<< rMethod
.name
<< '(';
596 printMethodParameters(o
, options
, manager
, rMethod
.parameters
, true);
598 printExceptionSpecification(o
, options
, manager
, rMethod
.exceptions
);
602 if (rMethod
.returnType
!= "void") {
603 o
<< " // TODO: Exchange the default return implementation for \""
604 << rMethod
.name
<< "\" !!!\n";
605 o
<< " // Exchange the default return implementation.\n"
606 " // NOTE: Default initialized polymorphic structs "
607 "can cause problems because of\n // missing default "
608 "initialization of primitive types of some C++ compilers or"
609 "\n // different Any initialization in Java and C++ "
610 "polymorphic structs.\n return ";
611 printType(o
, options
, manager
, rMethod
.returnType
, 8, true);
614 o
<< " // TODO: Insert your implementation for \""
615 << rMethod
.name
<< "\" here.";
619 o
<< "\n" << indentation
<< "{\n" << indentation
<< " ";
620 if (rMethod
.returnType
!= "void")
623 o
<< delegate
<< rMethod
.name
<< '(';
624 printMethodParameters(
625 o
, options
, manager
, rMethod
.parameters
, false);
626 o
<< ");\n" << indentation
<< "}\n\n";
637 static void printConstructors(
638 std::ostream
& o
, ProgramOptions
const & options
,
639 rtl::Reference
< TypeManager
> const & manager
, OUString
const & name
)
641 rtl::Reference
< unoidl::Entity
> ent
;
642 if (manager
->getSort(name
, &ent
)
643 != codemaker::UnoType::Sort::SingleInterfaceBasedService
)
645 throw CannotDumpException(
646 "unexpected entity \"" + name
647 + "\" in call to skeletonmaker::java::printConstructors");
649 rtl::Reference
< unoidl::SingleInterfaceBasedServiceEntity
> ent2(
650 dynamic_cast< unoidl::SingleInterfaceBasedServiceEntity
* >(ent
.get()));
652 for (const auto& rConstructor
: ent2
->getConstructors())
655 printType(o
, options
, manager
, ent2
->getBase(), 1);
657 if (rConstructor
.defaultConstructor
) {
660 o
<< codemaker::cpp::translateUnoToCppIdentifier(
661 u2b(rConstructor
.name
), "method");
663 o
<< ((options
.shortnames
) ? "(css::uno::Reference< css" :
664 "(::com::sun::star::uno::Reference< ::com::sun::star")
665 << "::uno::XComponentContext > const & the_context";
666 for (const auto& rParam
: rConstructor
.parameters
)
669 printType(o
, options
, manager
, rParam
.type
, 4);
671 << codemaker::cpp::translateUnoToCppIdentifier(
672 u2b(rParam
.name
), "param");
675 printExceptionSpecification(o
, options
, manager
, rConstructor
.exceptions
);
680 static void printServiceMembers(
681 std::ostream
& o
, ProgramOptions
const & options
,
682 rtl::Reference
< TypeManager
> const & manager
,
683 OUString
const & name
,
684 rtl::Reference
< unoidl::AccumulationBasedServiceEntity
> const & entity
,
685 OString
const & delegate
)
688 for (const auto& rService
: entity
->getDirectMandatoryBaseServices())
690 o
<< "\n// exported service " << rService
.name
<< "\n";
691 generateDocumentation(o
, options
, manager
, u2b(rService
.name
), delegate
);
692 o
<< "\n// end of exported service " << rService
.name
<< "\n";
694 for (const auto& rIface
: entity
->getDirectMandatoryBaseInterfaces())
696 o
<< "\n// supported interface " << rIface
.name
<< "\n";
697 generateDocumentation(o
, options
, manager
, u2b(rIface
.name
), delegate
);
699 if (delegate
.isEmpty()) {
700 o
<< "\n// properties of service \""<< name
<< "\"\n";
701 for (const auto& rProp
: entity
->getDirectProperties())
704 printType(o
, options
, manager
, rProp
.type
, 1);
706 << codemaker::cpp::translateUnoToCppIdentifier(
707 u2b(rProp
.name
), "property")
713 static void printMapsToCppType(
714 std::ostream
& o
, ProgramOptions
const & options
,
715 rtl::Reference
< TypeManager
> const & manager
,
716 codemaker::UnoType::Sort sort
, std::u16string_view nucleus
, sal_Int32 rank
,
717 std::vector
< OUString
> const & arguments
,
718 rtl::Reference
< unoidl::Entity
> const & entity
, const char * cppTypeSort
)
721 if (cppTypeSort
!= nullptr)
722 o
<< cppTypeSort
<< ' ';
725 if (rank
== 0 && nucleus
== u
"com.sun.star.uno.XInterface") {
726 o
<< "Reference< com::sun::star::uno::XInterface >";
729 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, entity
, 0,
735 void generateDocumentation(std::ostream
& o
,
736 ProgramOptions
const & options
, rtl::Reference
< TypeManager
> const & manager
,
737 OString
const & type
, OString
const & delegate
)
741 codemaker::UnoType::Sort sort
= manager
->decompose(
742 b2u(type
), false, &nucleus
, &rank
, nullptr, nullptr);
745 if (!delegate
.isEmpty()) {
746 if (sort
!= codemaker::UnoType::Sort::Interface
&&
747 sort
!= codemaker::UnoType::Sort::SingleInterfaceBasedService
&&
748 sort
!= codemaker::UnoType::Sort::AccumulationBasedService
)
758 o
<< " sequence type";
759 } else if (sort
<= codemaker::UnoType::Sort::Any
) {
763 case codemaker::UnoType::Sort::Interface
:
764 o
<< " interface type";
767 case codemaker::UnoType::Sort::Module
:
771 case codemaker::UnoType::Sort::PlainStruct
:
772 o
<< " simple struct type";
775 case codemaker::UnoType::Sort::PolymorphicStructTemplate
:
776 o
<< " polymorphic struct type template";
779 case codemaker::UnoType::Sort::InstantiatedPolymorphicStruct
:
780 o
<< " instantiated polymorphic struct type";
783 case codemaker::UnoType::Sort::Enum
:
787 case codemaker::UnoType::Sort::Exception
:
788 o
<< " exception type";
791 case codemaker::UnoType::Sort::Typedef
:
795 case codemaker::UnoType::Sort::SingleInterfaceBasedService
:
796 o
<< " single-inheritance--based service";
799 case codemaker::UnoType::Sort::AccumulationBasedService
:
800 o
<< "IDL accumulation-based service";
803 case codemaker::UnoType::Sort::InterfaceBasedSingleton
:
804 o
<< " inheritance-based singleton";
807 case codemaker::UnoType::Sort::ServiceBasedSingleton
:
808 o
<< "IDL service-based singleton";
811 case codemaker::UnoType::Sort::ConstantGroup
:
812 o
<< "IDL constant group";
820 o
<< " \"" << type
<< "\" ";
822 std::vector
< OUString
> arguments
;
823 rtl::Reference
< unoidl::Entity
> entity
;
824 sort
= manager
->decompose(
825 b2u(type
), true, &nucleus
, &rank
, &arguments
, &entity
);
829 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, entity
,
833 } else if (sort
<= codemaker::UnoType::Sort::Any
) {
836 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, entity
, nullptr);
841 case codemaker::UnoType::Sort::Interface
:
844 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, entity
,
846 if (nucleus
== "com.sun.star.uno.XInterface") {
851 o
<< "; " << (options
.all
? "all" : "direct") << " methods:\n";
853 codemaker::GeneratedTypeSet generated
;
855 o
, options
, manager
, nucleus
, generated
, delegate
,
856 options
.implname
, ""_ostr
);
860 case codemaker::UnoType::Sort::Module
:
862 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, entity
,
867 case codemaker::UnoType::Sort::PlainStruct
:
869 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, entity
,
871 o
<< "; full constructor:\n";
873 o
, options
, manager
, codemaker::UnoType::Sort::PlainStruct
,
874 entity
, nucleus
, arguments
);
877 case codemaker::UnoType::Sort::PolymorphicStructTemplate
:
879 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, entity
,
881 o
<< "; full constructor:\n";
884 codemaker::UnoType::Sort::PolymorphicStructTemplate
,
885 entity
, nucleus
, arguments
);
888 case codemaker::UnoType::Sort::InstantiatedPolymorphicStruct
:
890 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, entity
,
891 "class template instantiation");
892 o
<< "; full constructor:\n";
895 codemaker::UnoType::Sort::InstantiatedPolymorphicStruct
,
896 entity
, nucleus
, arguments
);
899 case codemaker::UnoType::Sort::Enum
:
901 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, entity
,
906 case codemaker::UnoType::Sort::ConstantGroup
:
908 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, entity
,
913 case codemaker::UnoType::Sort::Exception
:
915 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, entity
,
917 o
<< "; full constructor:\n";
919 o
, options
, manager
, codemaker::UnoType::Sort::Exception
,
920 entity
, nucleus
, arguments
);
923 case codemaker::UnoType::Sort::SingleInterfaceBasedService
:
926 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, entity
,
928 o
<< "; construction methods:\n";
929 printConstructors(o
, options
, manager
, nucleus
);
931 generateDocumentation(
933 u2b(dynamic_cast<unoidl::SingleInterfaceBasedServiceEntity
&>(*entity
)
938 case codemaker::UnoType::Sort::AccumulationBasedService
:
940 o
<< ("does not map to C++\n"
941 "// the service members are generated instead\n");
943 o
, options
, manager
, nucleus
,
944 dynamic_cast< unoidl::AccumulationBasedServiceEntity
* >(
949 case codemaker::UnoType::Sort::InterfaceBasedSingleton
:
951 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, entity
,
953 o
<< "; get method:\nstatic ";
956 dynamic_cast< unoidl::InterfaceBasedSingletonEntity
& >(
959 o
<< " get(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & context);\n";
962 case codemaker::UnoType::Sort::ServiceBasedSingleton
:
963 o
<< "does not map to C++\n";
976 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */