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"
24 #include "codemaker/codemaker.hxx"
25 #include "codemaker/commonjava.hxx"
26 #include "codemaker/global.hxx"
28 #include "skeletoncommon.hxx"
29 #include "skeletonjava.hxx"
31 using namespace ::rtl
;
33 namespace skeletonmaker
{ namespace java
{
36 std::ostream
& o
, ProgramOptions
const & options
,
37 rtl::Reference
< TypeManager
> const & manager
,
38 codemaker::UnoType::Sort sort
, OUString
const & nucleus
, sal_Int32 rank
,
39 std::vector
< OUString
> const & arguments
, bool referenceType
,
42 if (defaultvalue
&& rank
== 0 && sort
<= codemaker::UnoType::SORT_CHAR
) {
44 case codemaker::UnoType::SORT_BOOLEAN
:
47 case codemaker::UnoType::SORT_CHAR
:
48 case codemaker::UnoType::SORT_BYTE
:
49 case codemaker::UnoType::SORT_SHORT
:
50 case codemaker::UnoType::SORT_UNSIGNED_SHORT
:
51 case codemaker::UnoType::SORT_LONG
:
52 case codemaker::UnoType::SORT_UNSIGNED_LONG
:
53 case codemaker::UnoType::SORT_HYPER
:
54 case codemaker::UnoType::SORT_UNSIGNED_HYPER
:
55 case codemaker::UnoType::SORT_FLOAT
:
56 case codemaker::UnoType::SORT_DOUBLE
:
65 if (sort
== codemaker::UnoType::SORT_INTERFACE_TYPE
) {
68 } else if (sort
== codemaker::UnoType::SORT_ANY
&& rank
== 0) {
69 o
<< "com.sun.star.uno.Any.VOID";
71 } else if (sort
== codemaker::UnoType::SORT_TYPE
&& rank
== 0) {
72 o
<< "com.sun.star.uno.Type.VOID";
74 } else if (sort
!= codemaker::UnoType::SORT_ENUM_TYPE
|| rank
!= 0) {
80 codemaker::java::translateUnoToJavaType(
81 sort
, u2b(nucleus
), referenceType
&& rank
== 0));
82 if (sType
.startsWith("java.lang.")) {
83 sType
= sType
.copy(std::strlen("java.lang."));
86 if (!arguments
.empty() && options
.java5
) {
88 for (std::vector
< OUString
>::const_iterator
i(arguments
.begin());
89 i
!= arguments
.end(); ++i
)
91 if (i
!= arguments
.begin()) {
94 printType(o
, options
, manager
, *i
, true, false);
98 for (sal_Int32 i
= 0; i
!= rank
; ++i
) {
105 if (defaultvalue
&& sort
> codemaker::UnoType::SORT_CHAR
&& rank
== 0) {
106 if (sort
== codemaker::UnoType::SORT_ENUM_TYPE
)
107 o
<< ".getDefault()";
114 std::ostream
& o
, ProgramOptions
const & options
,
115 rtl::Reference
< TypeManager
> const & manager
, OUString
const & name
,
116 bool referenceType
, bool defaultvalue
)
120 std::vector
< OUString
> arguments
;
121 codemaker::UnoType::Sort sort
= manager
->decompose(
122 name
, true, &nucleus
, &rank
, &arguments
, 0);
124 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, referenceType
,
128 bool printConstructorParameters(
129 std::ostream
& o
, ProgramOptions
const & options
,
130 rtl::Reference
< TypeManager
> const & manager
,
131 codemaker::UnoType::Sort sort
,
132 rtl::Reference
< unoidl::Entity
> const & entity
, OUString
const & name
,
133 std::vector
< OUString
> const & arguments
)
135 bool previous
= false;
137 case codemaker::UnoType::SORT_PLAIN_STRUCT_TYPE
:
139 rtl::Reference
< unoidl::PlainStructTypeEntity
> ent2(
140 dynamic_cast< unoidl::PlainStructTypeEntity
* >(entity
.get()));
142 if (!ent2
->getDirectBase().isEmpty()) {
143 rtl::Reference
< unoidl::Entity
> baseEnt
;
144 codemaker::UnoType::Sort baseSort
= manager
->getSort(
145 ent2
->getDirectBase(), &baseEnt
);
146 previous
= printConstructorParameters(
147 o
, options
, manager
, baseSort
, baseEnt
,
148 ent2
->getDirectBase(), std::vector
< OUString
>());
150 for (std::vector
< unoidl::PlainStructTypeEntity::Member
>::
151 const_iterator
i(ent2
->getDirectMembers().begin());
152 i
!= ent2
->getDirectMembers().end(); ++i
)
158 printType(o
, options
, manager
, i
->type
, false);
160 << codemaker::java::translateUnoToJavaIdentifier(
161 u2b(i
->name
), "param");
165 case codemaker::UnoType::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE
:
167 rtl::Reference
< unoidl::PolymorphicStructTypeTemplateEntity
> ent2(
168 dynamic_cast< unoidl::PolymorphicStructTypeTemplateEntity
* >(
172 unoidl::PolymorphicStructTypeTemplateEntity::Member
>::
173 const_iterator
i(ent2
->getMembers().begin());
174 i
!= ent2
->getMembers().end(); ++i
)
180 if (i
->parameterized
) {
183 printType(o
, options
, manager
, i
->type
, false);
186 << codemaker::java::translateUnoToJavaIdentifier(
187 u2b(i
->name
), "param");
191 case codemaker::UnoType::SORT_INSTANTIATED_POLYMORPHIC_STRUCT_TYPE
:
193 rtl::Reference
< unoidl::PolymorphicStructTypeTemplateEntity
> ent2(
194 dynamic_cast< unoidl::PolymorphicStructTypeTemplateEntity
* >(
198 unoidl::PolymorphicStructTypeTemplateEntity::Member
>::
199 const_iterator
i(ent2
->getMembers().begin());
200 i
!= ent2
->getMembers().end(); ++i
)
206 if (i
->parameterized
) {
207 for (std::vector
< OUString
>::const_iterator
j(
208 ent2
->getTypeParameters().begin());
209 j
!= ent2
->getTypeParameters().end(); ++j
)
213 j
- ent2
->getTypeParameters().begin()];
218 printType(o
, options
, manager
, i
->type
, false);
221 << codemaker::java::translateUnoToJavaIdentifier(
222 u2b(i
->name
), "param");
226 case codemaker::UnoType::SORT_EXCEPTION_TYPE
:
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 (std::vector
< unoidl::ExceptionTypeEntity::Member
>::
240 const_iterator
i(ent2
->getDirectMembers().begin());
241 i
!= ent2
->getDirectMembers().end(); ++i
)
247 printType(o
, options
, manager
, i
->type
, false);
249 << codemaker::java::translateUnoToJavaIdentifier(
250 u2b(i
->name
), "param");
255 throw CannotDumpException(
256 "unexpected entity \"" + name
257 + "\" in call to skeletonmaker::cpp::printConstructorParameters");
262 void printConstructor(
263 std::ostream
& o
, ProgramOptions
const & options
,
264 rtl::Reference
< TypeManager
> const & manager
,
265 codemaker::UnoType::Sort sort
,
266 rtl::Reference
< unoidl::Entity
> const & entity
, OUString
const & name
,
267 std::vector
< OUString
> const & arguments
)
269 o
<< "public " << name
.copy(name
.lastIndexOf('.') + 1) << '(';
270 printConstructorParameters(
271 o
, options
, manager
, sort
, entity
, name
, arguments
);
275 void printMethodParameters(
276 std::ostream
& o
, ProgramOptions
const & options
,
277 rtl::Reference
< TypeManager
> const & manager
,
278 std::vector
< unoidl::InterfaceTypeEntity::Method::Parameter
> const &
282 for (std::vector
< unoidl::InterfaceTypeEntity::Method::Parameter
>::
283 const_iterator
i(parameters
.begin());
284 i
!= parameters
.end(); ++i
)
286 if (i
!= parameters
.begin()) {
290 printType(o
, options
, manager
, i
->type
, false);
292 != unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_IN
)
298 o
<< codemaker::java::translateUnoToJavaIdentifier(
299 u2b(i
->name
), "param");
303 void printExceptionSpecification(
304 std::ostream
& o
, ProgramOptions
const & options
,
305 rtl::Reference
< TypeManager
> const & manager
,
306 std::vector
< OUString
> const & exceptions
)
308 if (!exceptions
.empty()) {
310 for (std::vector
< OUString
>::const_iterator
i(exceptions
.begin());
311 i
!= exceptions
.end(); ++i
)
313 if (i
!=exceptions
.begin() ) {
316 printType(o
, options
, manager
, *i
, false);
322 void printSetPropertyMixinBody(
323 std::ostream
& o
, unoidl::InterfaceTypeEntity::Attribute
const & attribute
,
324 OString
const & indentation
)
326 unoidl::AccumulationBasedServiceEntity::Property::Attributes propFlags
327 = checkAdditionalPropertyFlags(attribute
);
329 o
<< "\n" << indentation
<< "{\n";
331 if ( attribute
.bound
) {
332 o
<< indentation
<< " PropertySetMixin.BoundListeners l = "
333 "new PropertySetMixin.BoundListeners();\n\n";
336 o
<< indentation
<< " m_prophlp.prepareSet(\""
337 << attribute
.name
<< "\", ";
338 if ( propFlags
& unoidl::AccumulationBasedServiceEntity::Property::ATTRIBUTE_CONSTRAINED
) {
339 OString fieldtype
= codemaker::convertString(attribute
.type
);
341 sal_Int32 index
= fieldtype
.lastIndexOf('<');
344 bool optional
= false;
345 OStringBuffer
buffer1(64);
346 OStringBuffer
buffer2(64);
349 OString
s(fieldtype
.getToken(0, '<', nPos
));
350 OStringBuffer
buffer(16);
352 buffer
.append(s
.copy(s
.lastIndexOf('/')+1));
354 OString t
= buffer
.makeStringAndClear();
356 if ( t
.equals("((Optional)") ) {
360 buffer1
.append("the_value.IsPresent");
361 buffer2
.append("the_value.Value");
363 buffer1
.insert(0, t
);
364 buffer1
.append(").IsPresent");
365 buffer2
.insert(0, t
);
366 buffer2
.append(").Value");
372 buffer1
.append("the_value.Value");
374 buffer2
.append("the_value.Value");
377 buffer1
.insert(0, t
);
378 buffer1
.append(").Value");
380 buffer2
.insert(0, t
);
381 buffer2
.append(").Value");
384 } while( nPos
<= index
);
386 o
<< "Any.VOID,\n" << indentation
<< " ";
389 o
<< buffer1
.makeStringAndClear();
391 o
<< ") ? " << buffer2
.makeStringAndClear() << " : Any.VOID,\n"
392 << indentation
<< " ";
397 if ( attribute
.bound
)
403 o
<< indentation
<< " synchronized (this) {\n"
404 << indentation
<< " m_" << attribute
.name
405 << " = the_value;\n" << indentation
<< " }\n";
407 if ( attribute
.bound
) {
408 o
<< indentation
<< " l.notifyListeners();\n";
410 o
<< indentation
<< "}\n\n";
413 void generateXPropertySetBodies(std::ostream
& o
);
414 void generateXFastPropertySetBodies(std::ostream
& o
);
415 void generateXPropertyAccessBodies(std::ostream
& o
);
417 void printMethods(std::ostream
& o
,
418 ProgramOptions
const & options
, rtl::Reference
< TypeManager
> const & manager
,
419 OUString
const & name
,
420 codemaker::GeneratedTypeSet
& generated
,
421 OString
const & delegate
, OString
const & indentation
,
422 bool defaultvalue
, bool usepropertymixin
)
424 if ( generated
.contains(u2b(name
)) || name
== "com.sun.star.uno.XInterface" ||
426 ( name
== "com.sun.star.lang.XComponent" ||
427 name
== "com.sun.star.lang.XTypeProvider" ||
428 name
== "com.sun.star.uno.XWeak" ) ) ) {
432 if ( usepropertymixin
) {
433 if (name
== "com.sun.star.beans.XPropertySet") {
434 generated
.add(u2b(name
));
435 generateXPropertySetBodies(o
);
437 } else if (name
== "com.sun.star.beans.XFastPropertySet") {
438 generated
.add(u2b(name
));
439 generateXFastPropertySetBodies(o
);
441 } else if (name
== "com.sun.star.beans.XPropertyAccess") {
442 generated
.add(u2b(name
));
443 generateXPropertyAccessBodies(o
);
448 static OString
sd("_");
449 bool body
= !delegate
.isEmpty();
450 bool defaultbody
= ((delegate
.equals(sd
)) ? true : false);
452 generated
.add(u2b(name
));
453 rtl::Reference
< unoidl::Entity
> ent
;
454 if (manager
->getSort(name
, &ent
) != codemaker::UnoType::SORT_INTERFACE_TYPE
)
456 throw CannotDumpException(
457 "unexpected entity \"" + name
458 + "\" in call to skeletonmaker::java::printMethods");
460 rtl::Reference
< unoidl::InterfaceTypeEntity
> ent2(
461 dynamic_cast< unoidl::InterfaceTypeEntity
* >(ent
.get()));
463 if ( options
.all
|| defaultvalue
) {
464 for (std::vector
< unoidl::AnnotatedReference
>::const_iterator
i(
465 ent2
->getDirectMandatoryBases().begin());
466 i
!= ent2
->getDirectMandatoryBases().end(); ++i
)
469 o
, options
, manager
, i
->name
, generated
, delegate
, indentation
,
470 defaultvalue
, usepropertymixin
);
472 if (!(ent2
->getDirectAttributes().empty()
473 && ent2
->getDirectMethods().empty()))
475 o
<< indentation
<< "// ";
476 printType(o
, options
, manager
, name
, false);
480 for (std::vector
< unoidl::InterfaceTypeEntity::Attribute
>::const_iterator
481 i(ent2
->getDirectAttributes().begin());
482 i
!= ent2
->getDirectAttributes().end(); ++i
)
484 o
<< indentation
<< "public ";
485 printType(o
, options
, manager
, i
->type
, false);
486 o
<< " get" << i
->name
<< "()";
487 printExceptionSpecification(o
, options
, manager
, i
->getExceptions
);
490 if ( usepropertymixin
) {
491 o
<< "\n" << indentation
<< "{\n" << indentation
492 << " return m_" << i
->name
<< ";\n" << indentation
495 o
<< "\n" << indentation
<< "{\n" << indentation
497 printType(o
, options
, manager
, i
->type
, false, true);
498 o
<< ";\n" << indentation
<< "}\n\n";
501 o
<< "\n" << indentation
<< "{\n" << indentation
502 << " return " << delegate
.getStr() << "get" << i
->name
503 << "();\n" << indentation
<< "}\n\n";
511 o
<< indentation
<< "public void set" << i
->name
<< '(';
512 printType(o
, options
, manager
, i
->type
, false);
514 printExceptionSpecification(o
, options
, manager
, i
->setExceptions
);
517 if ( usepropertymixin
) {
518 printSetPropertyMixinBody(o
, *i
, indentation
);
520 o
<< "\n" << indentation
<< "{\n\n" << indentation
524 o
<< "\n" << indentation
<< "{\n" << indentation
525 << " " << delegate
.getStr() << "set" << i
->name
526 << "(the_value);\n" << indentation
<< "}\n\n";
533 for (std::vector
< unoidl::InterfaceTypeEntity::Method
>::const_iterator
i(
534 ent2
->getDirectMethods().begin());
535 i
!= ent2
->getDirectMethods().end(); ++i
)
537 o
<< indentation
<< "public ";
538 printType(o
, options
, manager
, i
->returnType
, false);
539 o
<< ' ' << i
->name
<< '(';
540 printMethodParameters(o
, options
, manager
, i
->parameters
, true);
542 printExceptionSpecification(o
, options
, manager
, i
->exceptions
);
545 o
<< "\n" << indentation
<< "{\n";
546 if (i
->returnType
!= "void") {
547 o
<< indentation
<< " // TODO: Exchange the default return "
548 << "implementation for \"" << i
->name
<< "\" !!!\n";
549 o
<< indentation
<< " // NOTE: "
550 "Default initialized polymorphic structs can cause problems"
551 "\n" << indentation
<< " // because of missing default "
552 "initialization of primitive types of\n" << indentation
553 << " // some C++ compilers or different Any initialization"
554 " in Java and C++\n" << indentation
555 << " // polymorphic structs.\n" << indentation
557 printType(o
, options
, manager
, i
->returnType
, false, true);
560 o
<< indentation
<< " // TODO: Insert your implementation for \""
561 << i
->name
<< "\" here.";
563 o
<< "\n" << indentation
<< "}\n\n";
565 o
<< "\n" << indentation
<< "{\n" << indentation
<< " ";
566 if (i
->returnType
!= "void") {
569 o
<< delegate
.getStr() << i
->name
<< '(';
570 printMethodParameters(
571 o
, options
, manager
, i
->parameters
, false);
572 o
<< ");\n" << indentation
<< "}\n\n";
580 void printConstructors(
581 std::ostream
& o
, ProgramOptions
const & options
,
582 rtl::Reference
< TypeManager
> const & manager
, OUString
const & name
)
584 rtl::Reference
< unoidl::Entity
> ent
;
585 if (manager
->getSort(name
, &ent
)
586 != codemaker::UnoType::SORT_SINGLE_INTERFACE_BASED_SERVICE
)
588 throw CannotDumpException(
589 "unexpected entity \"" + name
590 + "\" in call to skeletonmaker::java::printConstructors");
592 rtl::Reference
< unoidl::SingleInterfaceBasedServiceEntity
> ent2(
593 dynamic_cast< unoidl::SingleInterfaceBasedServiceEntity
* >(ent
.get()));
595 for (std::vector
< unoidl::SingleInterfaceBasedServiceEntity::Constructor
>::
596 const_iterator
i(ent2
->getConstructors().begin());
597 i
!= ent2
->getConstructors().end(); ++i
)
599 o
<< "public static ";
600 printType(o
, options
, manager
, ent2
->getBase(), false);
602 if (i
->defaultConstructor
) {
605 o
<< codemaker::java::translateUnoToJavaIdentifier(
606 u2b(i
->name
), "method");
608 o
<< "(com.sun.star.uno.XComponentContext the_context";
610 unoidl::SingleInterfaceBasedServiceEntity::Constructor::
611 Parameter
>::const_iterator
j(i
->parameters
.begin());
612 j
!= i
->parameters
.end(); ++i
)
615 printType(o
, options
, manager
, j
->type
, false);
617 o
<< (options
.java5
? "..." : "[]");
620 << codemaker::java::translateUnoToJavaIdentifier(
621 u2b(j
->name
), "param");
624 printExceptionSpecification(o
, options
, manager
, i
->exceptions
);
629 void generateDocumentation(std::ostream
& o
,
630 ProgramOptions
const & options
, rtl::Reference
< TypeManager
> const & manager
,
631 OString
const & type
);
633 void printServiceMembers(
634 std::ostream
& o
, ProgramOptions
const & options
,
635 rtl::Reference
< TypeManager
> const & manager
,
636 OUString
const & name
,
637 rtl::Reference
< unoidl::AccumulationBasedServiceEntity
> const & entity
,
638 OString
const & delegate
)
641 for (std::vector
< unoidl::AnnotatedReference
>::const_iterator
i(
642 entity
->getDirectMandatoryBaseServices().begin());
643 i
!= entity
->getDirectMandatoryBaseServices().end(); ++i
)
645 o
<< "\n// exported service " << i
->name
<< "\n";
646 generateDocumentation(o
, options
, manager
, u2b(i
->name
), delegate
);
648 for (std::vector
< unoidl::AnnotatedReference
>::const_iterator
i(
649 entity
->getDirectMandatoryBaseInterfaces().begin());
650 i
!= entity
->getDirectMandatoryBaseInterfaces().end(); ++i
)
652 o
<< "\n// supported interface " << i
->name
<< "\n";
653 generateDocumentation(o
, options
, manager
, u2b(i
->name
), delegate
);
655 o
<< "\n// properties of service \""<< name
<< "\"\n";
656 for (std::vector
< unoidl::AccumulationBasedServiceEntity::Property
>::
657 const_iterator
i(entity
->getDirectProperties().begin());
658 i
!= entity
->getDirectProperties().end(); ++i
)
661 printType(o
, options
, manager
, i
->type
, false);
663 << codemaker::java::translateUnoToJavaIdentifier(
664 u2b(i
->name
), "property")
669 void printMapsToJavaType(
670 std::ostream
& o
, ProgramOptions
const & options
,
671 rtl::Reference
< TypeManager
> const & manager
,
672 codemaker::UnoType::Sort sort
, OUString
const & nucleus
, sal_Int32 rank
,
673 std::vector
< OUString
> const & arguments
, const char * javaTypeSort
)
675 o
<< "maps to Java " << (options
.java5
? "1.5" : "1.4") << " ";
676 if (javaTypeSort
!= 0) {
677 o
<< javaTypeSort
<< ' ';
680 if (rank
== 0 && nucleus
== "com.sun.star.uno.XInterface") {
681 o
<< "com.sun.star.uno.XInterface";
684 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, false, false);
689 void generateDocumentation(std::ostream
& o
,
690 ProgramOptions
const & options
, rtl::Reference
< TypeManager
> const & manager
,
691 OString
const & type
, OString
const & delegate
)
695 codemaker::UnoType::Sort sort
= manager
->decompose(
696 b2u(type
), false, &nucleus
, &rank
, 0, 0);
699 if (!delegate
.isEmpty()) {
700 if (sort
!= codemaker::UnoType::SORT_INTERFACE_TYPE
&&
701 sort
!= codemaker::UnoType::SORT_SINGLE_INTERFACE_BASED_SERVICE
&&
702 sort
!= codemaker::UnoType::SORT_ACCUMULATION_BASED_SERVICE
)
712 o
<< " sequence type";
713 } else if (sort
<= codemaker::UnoType::SORT_ANY
) {
717 case codemaker::UnoType::SORT_INTERFACE_TYPE
:
718 o
<< " interface type";
721 case codemaker::UnoType::SORT_MODULE
:
725 case codemaker::UnoType::SORT_PLAIN_STRUCT_TYPE
:
726 o
<< " simple struct type";
729 case codemaker::UnoType::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE
:
730 o
<< " polymorphic struct type template";
733 case codemaker::UnoType::SORT_INSTANTIATED_POLYMORPHIC_STRUCT_TYPE
:
734 o
<< " instantiated polymorphic struct type";
737 case codemaker::UnoType::SORT_ENUM_TYPE
:
741 case codemaker::UnoType::SORT_EXCEPTION_TYPE
:
742 o
<< " exception type";
745 case codemaker::UnoType::SORT_TYPEDEF
:
749 case codemaker::UnoType::SORT_SINGLE_INTERFACE_BASED_SERVICE
:
750 o
<< " single-inheritance--based service";
753 case codemaker::UnoType::SORT_ACCUMULATION_BASED_SERVICE
:
754 o
<< "IDL accumulation-based service";
757 case codemaker::UnoType::SORT_INTERFACE_BASED_SINGLETON
:
758 o
<< " inheritance-based singleton";
761 case codemaker::UnoType::SORT_SERVICE_BASED_SINGLETON
:
762 o
<< "IDL service-based singleton";
765 case codemaker::UnoType::SORT_CONSTANT_GROUP
:
766 o
<< "IDL constant group";
774 o
<< " \"" << type
<< "\" ";
776 std::vector
< OUString
> arguments
;
777 rtl::Reference
< unoidl::Entity
> entity
;
778 sort
= manager
->decompose(
779 b2u(type
), true, &nucleus
, &rank
, &arguments
, &entity
);
782 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, "array");
784 } else if (sort
<= codemaker::UnoType::SORT_ANY
) {
786 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, 0);
790 case codemaker::UnoType::SORT_INTERFACE_TYPE
:
792 o
, options
, manager
, sort
, nucleus
, rank
, arguments
,
794 if (nucleus
== "com.sun.star.uno.XInterface") {
797 o
<< "; " << (options
.all
? "all" : "direct") << " methods:\n";
798 codemaker::GeneratedTypeSet generated
;
800 o
, options
, manager
, nucleus
, generated
, delegate
, "");
804 case codemaker::UnoType::SORT_MODULE
:
806 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, "package");
810 case codemaker::UnoType::SORT_PLAIN_STRUCT_TYPE
:
812 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, "class");
813 o
<< "; full constructor:\n";
815 o
, options
, manager
, codemaker::UnoType::SORT_PLAIN_STRUCT_TYPE
,
816 entity
, nucleus
, arguments
);
819 case codemaker::UnoType::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE
:
821 o
, options
, manager
, sort
, nucleus
, rank
, arguments
,
822 options
.java5
? "generic class" : "class");
823 o
<< "; full constructor:\n";
826 codemaker::UnoType::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE
,
827 entity
, nucleus
, arguments
);
830 case codemaker::UnoType::SORT_INSTANTIATED_POLYMORPHIC_STRUCT_TYPE
:
832 o
, options
, manager
, sort
, nucleus
, rank
, arguments
,
833 options
.java5
? "generic class instantiation" : "class");
834 o
<< "; full constructor:\n";
837 codemaker::UnoType::SORT_INSTANTIATED_POLYMORPHIC_STRUCT_TYPE
,
838 entity
, nucleus
, arguments
);
841 case codemaker::UnoType::SORT_ENUM_TYPE
:
842 case codemaker::UnoType::SORT_CONSTANT_GROUP
:
844 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, "class");
848 case codemaker::UnoType::SORT_EXCEPTION_TYPE
:
850 o
, options
, manager
, sort
, nucleus
, rank
, arguments
,
852 o
<< "; full constructor:\n";
854 o
, options
, manager
, codemaker::UnoType::SORT_EXCEPTION_TYPE
,
855 entity
, nucleus
, arguments
);
858 case codemaker::UnoType::SORT_SINGLE_INTERFACE_BASED_SERVICE
:
860 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, "class");
861 o
<< "; construction methods:\n";
862 printConstructors(o
, options
, manager
, nucleus
);
863 generateDocumentation(
865 u2b(dynamic_cast< unoidl::SingleInterfaceBasedServiceEntity
* >(
866 entity
.get())->getBase()),
870 case codemaker::UnoType::SORT_ACCUMULATION_BASED_SERVICE
:
871 o
<< ("does not map to Java\n"
872 "// the service members are generated instead\n");
874 o
, options
, manager
, nucleus
,
875 dynamic_cast< unoidl::AccumulationBasedServiceEntity
* >(
880 case codemaker::UnoType::SORT_INTERFACE_BASED_SINGLETON
:
882 o
, options
, manager
, sort
, nucleus
, rank
, arguments
, "class");
883 o
<< "; get method:\npublic static ";
886 dynamic_cast< unoidl::InterfaceBasedSingletonEntity
* >(
887 entity
.get())->getBase(),
889 o
<< " get(com.sun.star.uno.XComponentContext context);\n";
892 case codemaker::UnoType::SORT_SERVICE_BASED_SINGLETON
:
893 o
<< "does not map to Java\n";
906 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */