LibreOffice Module unodevtools (master) 1
cpptypemaker.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <sal/config.h>
21
24#include <codemaker/global.hxx>
25
26#include "skeletoncommon.hxx"
27#include "skeletoncpp.hxx"
28
29#include <algorithm>
30#include <string_view>
31
32using namespace ::codemaker::cpp;
33
34namespace skeletonmaker::cpp {
35
36static 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,
42 bool defaultvalue)
43{
44 if (defaultvalue && rank == 0 && sort <= codemaker::UnoType::Sort::Char) {
45 switch (sort) {
47 o << "sal_False";
48 return;
59 o << "0";
60 return;
61 default:
62 break;
63 }
64 }
65
66 if (defaultvalue && referenceType == 16) {
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;
72 }
73 return;
74 }
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))
80 {
81 bReference = true;
82 }
83
84 if (bReference && referenceType == 4)
85 o << "const ";
86
87 for (sal_Int32 i = 0; i < rank; ++i) {
88 o << ((options.shortnames) ? "css::uno::Sequence< " :
89 "::com::sun::star::uno::Sequence< ");
90 }
91 if (sort == codemaker::UnoType::Sort::Interface && referenceType > 0) {
92 o << ((options.shortnames) ? "css::uno::Reference< " :
93 "::com::sun::star::uno::Reference< ");
94 }
95
97 options.shortnames && referenceType > 0);
98
99 if (sort == codemaker::UnoType::Sort::Interface && referenceType > 0)
100 o << " >";
101
102 if (!arguments.empty()) {
103 o << "< ";
104 for (std::vector< OUString >::const_iterator i(arguments.begin());
105 i != arguments.end(); ++i)
106 {
107 if (i != arguments.begin())
108 o << ", ";
109
110 printType(o, options, manager, *i, 1);
111 }
112 o << " >";
113 }
114
115 for (sal_Int32 i = 0; i < rank; ++i)
116 o << " >";
117
118 if (bReference && referenceType > 1)
119 o << " &";
120
121 if (referenceType == 8 && (sort > codemaker::UnoType::Sort::Char || rank > 0))
122 o << "()";
123}
124
126 std::ostream & o, ProgramOptions const & options,
127 rtl::Reference< TypeManager > const & manager, std::u16string_view name,
128 short referenceType, bool defaultvalue)
129{
130 OUString nucleus;
131 sal_Int32 rank;
132 std::vector< OUString > arguments;
134 codemaker::UnoType::Sort sort = manager->decompose(
135 name, true, &nucleus, &rank, &arguments, &entity);
136 printType(
137 o, options, manager, sort, nucleus, rank, arguments, entity,
138 referenceType, defaultvalue);
139}
140
142 std::ostream & o, ProgramOptions const & options,
143 rtl::Reference< TypeManager > const & manager,
145 rtl::Reference< unoidl::Entity > const & entity, std::u16string_view name,
146 std::vector< OUString > const & arguments)
147{
148 bool previous = false;
149 switch (sort) {
151 {
153 dynamic_cast< unoidl::PlainStructTypeEntity * >(entity.get()));
154 assert(ent2.is());
155 if (!ent2->getDirectBase().isEmpty()) {
157 codemaker::UnoType::Sort baseSort = manager->getSort(
158 ent2->getDirectBase(), &baseEnt);
160 o, options, manager, baseSort, baseEnt,
161 ent2->getDirectBase(), std::vector< OUString >());
162 }
163 for (const auto& rMember : ent2->getDirectMembers())
164 {
165 if (previous) {
166 o << ", ";
167 }
168 previous = true;
169 printType(o, options, manager, rMember.type, 4);
170 o << ' '
172 u2b(rMember.name), "param");
173 }
174 break;
175 }
177 {
180 entity.get()));
181 assert(ent2.is());
182 for (const auto& rMember : ent2->getMembers())
183 {
184 if (previous) {
185 o << ", ";
186 }
187 previous = true;
188 if (rMember.parameterized) {
189 o << rMember.type;
190 } else {
191 printType(o, options, manager, rMember.type, 4);
192 }
193 o << ' '
195 u2b(rMember.name), "param");
196 }
197 break;
198 }
200 {
203 entity.get()));
204 assert(ent2.is());
205 for (const auto& rMember : ent2->getMembers())
206 {
207 if (previous) {
208 o << ", ";
209 }
210 previous = true;
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()];
216 }
217 } else {
218 printType(o, options, manager, rMember.type, 4);
219 }
220 o << ' '
222 u2b(rMember.name), "param");
223 }
224 break;
225 }
227 {
229 dynamic_cast< unoidl::ExceptionTypeEntity * >(entity.get()));
230 assert(ent2.is());
231 if (!ent2->getDirectBase().isEmpty()) {
233 codemaker::UnoType::Sort baseSort = manager->getSort(
234 ent2->getDirectBase(), &baseEnt);
236 o, options, manager, baseSort, baseEnt,
237 ent2->getDirectBase(), std::vector< OUString >());
238 }
239 for (const auto& rMember : ent2->getDirectMembers())
240 {
241 if (previous) {
242 o << ", ";
243 }
244 previous = true;
245 printType(o, options, manager, rMember.type, 4);
246 o << ' '
248 u2b(rMember.name), "param");
249 }
250 break;
251 }
252 default:
254 OUString::Concat("unexpected entity \"") + name
255 + "\" in call to skeletonmaker::cpp::printConstructorParameters");
256 }
257 return previous;
258}
259
261 std::ostream & o, ProgramOptions const & options,
262 rtl::Reference< TypeManager > const & manager,
264 rtl::Reference< unoidl::Entity > const & entity, std::u16string_view name,
265 std::vector< OUString > const & arguments)
266{
267 o << "public " << OUString(name.substr(name.rfind('.') + 1)) << '(';
269 o, options, manager, sort, entity, name, arguments);
270 o << ");\n";
271}
272
274 std::ostream & o, ProgramOptions const & options,
275 rtl::Reference< TypeManager > const & manager,
276 std::vector< unoidl::InterfaceTypeEntity::Method::Parameter > const &
277 parameters,
278 bool withType)
279{
280 for (std::vector< unoidl::InterfaceTypeEntity::Method::Parameter >::
281 const_iterator i(parameters.begin());
282 i != parameters.end(); ++i)
283 {
284 if (i != parameters.begin()) {
285 o << ", ";
286 }
287 if (withType) {
288 short referenceType;
289 if (i->direction
291 {
292 referenceType = 4;
293 } else {
294 referenceType = 2;
295 }
296 printType(o, options, manager, i->type, referenceType);
297 o << ' ';
298 }
300 }
301}
302
304 std::ostream & o,
305 ProgramOptions const & options,
306 rtl::Reference< TypeManager > const & manager,
307 std::vector< OUString > const & exceptions)
308{
309 o << ((options.shortnames) ? " throw (css::uno::RuntimeException" :
310 " throw (::com::sun::star::uno::RuntimeException");
311 for (const auto& rException : exceptions)
312 {
313 o << ", ";
314 printType(o, options, manager, rException, 1);
315 }
316 o << ")";
317}
318
320 std::ostream & o, unoidl::InterfaceTypeEntity::Attribute const & attribute)
321{
324
325 o << "\n{\n";
326
327 if (attribute.bound)
328 o << " BoundListeners l;\n";
329
331 OString fieldtype = codemaker::convertString(attribute.type);
332
333 sal_Int32 index = fieldtype.lastIndexOf('<');
334 sal_Int32 nPos=0;
335 bool single = true;
336 bool optional = false;
337 OStringBuffer buffer1(64);
338 OStringBuffer buffer2(64);
339 do
340 {
341 OString s(fieldtype.getToken(0, '<', nPos));
342 OString t = s.copy(s.lastIndexOf('/')+1);
343
344 if (t == "Optional") {
345 optional=true;
346 if (single) {
347 single=false;
348 buffer1.append("the_value.IsPresent");
349 buffer2.append("the_value.Value");
350 } else {
351 buffer1.insert(0, t);
352 buffer1.append(".IsPresent");
353 buffer2.insert(0, t);
354 buffer2.append(".Value");
355 }
356 } else {
357 if (single) {
358 single=false;
359 if (!optional)
360 buffer1.append("the_value.Value");
361
362 buffer2.append("the_value.Value");
363 } else {
364 if (!optional) {
365 buffer1.insert(0, t);
366 buffer1.append(".Value");
367 }
368 buffer2.insert(0, t);
369 buffer2.append(".Value");
370 }
371 }
372 } while( nPos <= index );
373
374 o << " css::uno::Any v;\n";
375 if (optional) {
376 o << " if(" << buffer1.makeStringAndClear() << ")\n {\n v <<= " << buffer2.makeStringAndClear() << ";\n }\n";
377 } else {
378 o << " v <<= " << buffer2.makeStringAndClear() << ";\n\n";
379 }
380
381 o << " prepareSet(\n OUString(\""
382 << attribute.name << "\"),\n css::uno::Any(), v, ";
383 } else {
384 o << " prepareSet(\n OUString(\""
385 << attribute.name << "\"),\n css::uno::Any(), css::uno::Any(), ";
386 }
387
388 if (attribute.bound)
389 o << "&l);\n";
390 else
391 o << "0);\n";
392
393 o << " {\n osl::MutexGuard g(m_aMutex);\n m_"
394 << attribute.name << " = the_value;\n }\n";
395
396 if (attribute.bound)
397 o << " l.notify();\n";
398
399 o << "}\n\n";
400}
401
402void 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)
408{
409 if (generated.contains(u2b(name)) || name == "com.sun.star.uno.XInterface" ||
410 (defaultvalue &&
411 ( name == "com.sun.star.lang.XComponent" ||
412 name == "com.sun.star.lang.XTypeProvider" ||
413 name == "com.sun.star.uno.XWeak" ) ) )
414 {
415 return;
416 }
417
418 static OString sd("_");
419 bool body = !delegate.isEmpty();
420 bool defaultbody = delegate == sd;
421
422 if (body && propertyhelper.getLength() > 1) {
423 if (name == "com.sun.star.beans.XPropertySet") {
424 generated.add(u2b(name));
426 o, classname, scopedCppName(u2b(propertyhelper)));
427 return;
428 } else if (name == "com.sun.star.beans.XFastPropertySet") {
429 generated.add(u2b(name));
431 o, classname, scopedCppName(u2b(propertyhelper)));
432 return;
433 } else if (name == "com.sun.star.beans.XPropertyAccess") {
434 generated.add(u2b(name));
436 o, classname, scopedCppName(u2b(propertyhelper)));
437 return;
438 }
439 }
440
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 "
446 "return OUString("
447 "sADDIN_SERVICENAME);\n}\n";
448 generated.add(u2b(name));
449 return;
450 } else if (name == "com.sun.star.sheet.XAddIn") {
451 generateXAddInBodies(o, classname);
452 generated.add(u2b(name));
453
454 // special handling of XLocalizable -> parent of XAddIn
455 if (!generated.contains("com.sun.star.lang.XLocalizable")) {
456 generateXLocalizable(o, classname);
457 generated.add("com.sun.star.lang.XLocalizable");
458 }
459 return;
460 } else if (name == "com.sun.star.lang.XLocalizable") {
461 generateXLocalizable(o, classname);
462 generated.add(u2b(name));
463 return;
464 } else if (name == "com.sun.star.sheet.XCompatibilityNames") {
466 generated.add(u2b(name));
467 return;
468 }
469 }
470
471 if (body && options.componenttype == 3) {
472 if (name == "com.sun.star.lang.XInitialization") {
473 generateXInitialization(o, classname);
474 generated.add(u2b(name));
475 return;
476 } else if (name == "com.sun.star.frame.XDispatch") {
477 generateXDispatch(o, classname, options.protocolCmdMap);
478 generated.add(u2b(name));
479 return;
480 } else if (name == "com.sun.star.frame.XDispatchProvider") {
481 generateXDispatchProvider(o, classname, options.protocolCmdMap);
482 generated.add(u2b(name));
483 return;
484 }
485 }
486
487 generated.add(u2b(name));
489 if (manager->getSort(name, &ent) != codemaker::UnoType::Sort::Interface)
490 {
492 "unexpected entity \"" + name
493 + "\" in call to skeletonmaker::cpp::printMethods");
494 }
496 dynamic_cast< unoidl::InterfaceTypeEntity * >(ent.get()));
497 assert(ent2.is());
498 if (options.all || defaultvalue) {
499 for (const auto& rBase : ent2->getDirectMandatoryBases())
500 {
502 o, options, manager, rBase.name, generated, delegate, classname,
503 indentation, defaultvalue, propertyhelper);
504 }
505 if (!(ent2->getDirectAttributes().empty()
506 && ent2->getDirectMethods().empty()))
507 {
508 o << indentation << "// ";
509 printType(o, options, manager, name, 0);
510 o << ":\n";
511 }
512 }
513 for (const auto& rAttr : ent2->getDirectAttributes())
514 {
515 o << indentation;
516 if (!body)
517 o << "virtual ";
518
519 printType(o, options, manager, rAttr.type, 1);
520 o << " SAL_CALL ";
521 if (!classname.isEmpty())
522 o << classname;
523
524 o << "get" << rAttr.name << "()";
525 printExceptionSpecification(o, options, manager, rAttr.getExceptions);
526 if (body) {
527 if (defaultbody) {
528 if (!propertyhelper.isEmpty()) {
529 o << "\n{\n osl::MutexGuard g(m_aMutex);\n return m_"
530 << rAttr.name << ";\n}\n\n";
531 } else {
532 o << "\n{\n return ";
533 if (options.componenttype == 1) {
534 o << "m_" << rAttr.name;
535 } else {
536 printType(o, options, manager, rAttr.type, 8, true);
537 }
538 o << ";\n}\n\n";
539 }
540 } else {
541 o << "\n" << indentation << "{\n" << indentation << " return "
542 << delegate << "get" << rAttr.name << "();\n"
543 << indentation << "}\n\n";
544 }
545 } else {
546 o << ";\n";
547 }
548
549 if (!rAttr.readOnly) {
550 o << indentation;
551 if (!body)
552 o << "virtual ";
553
554 o << "void SAL_CALL ";
555 if (!classname.isEmpty())
556 o << classname;
557
558 o << "set" << rAttr.name << '(';
559 printType(o, options, manager, rAttr.type, 4);
560 o << " the_value)";
561 printExceptionSpecification(o, options, manager, rAttr.setExceptions);
562 if (body) {
563 if (defaultbody) {
564 if (!propertyhelper.isEmpty()) {
566 } else {
567 if (options.componenttype == 1) {
568 o << "\n{\n m_" << rAttr.name
569 << " = the_value;\n}\n\n";
570 } else {
571 o << "\n{\n\n}\n\n";
572 }
573 }
574 } else {
575 o << "\n" << indentation << "{\n" << indentation << " "
576 << delegate << "set" << rAttr.name
577 << "(the_value);\n" << indentation << "}\n\n";
578 }
579 } else {
580 o << ";\n";
581 }
582 }
583 }
584 for (const auto& rMethod : ent2->getDirectMethods())
585 {
586 o << indentation;
587 if (!body)
588 o << "virtual ";
589
590 printType(o, options, manager, rMethod.returnType, 1);
591 o << " SAL_CALL ";
592 if (!classname.isEmpty())
593 o << classname;
594
595 o << rMethod.name << '(';
596 printMethodParameters(o, options, manager, rMethod.parameters, true);
597 o << ')';
598 printExceptionSpecification(o, options, manager, rMethod.exceptions);
599 if (body) {
600 if (defaultbody) {
601 o << "\n{\n";
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);
612 o << ";";
613 } else {
614 o << " // TODO: Insert your implementation for \""
615 << rMethod.name << "\" here.";
616 }
617 o << "\n}\n\n";
618 } else {
619 o << "\n" << indentation << "{\n" << indentation << " ";
620 if (rMethod.returnType != "void")
621 o << "return ";
622
623 o << delegate << rMethod.name << '(';
625 o, options, manager, rMethod.parameters, false);
626 o << ");\n" << indentation << "}\n\n";
627 }
628 } else {
629 o << ";\n";
630 }
631 }
632
633 if (!body)
634 o << "\n";
635}
636
638 std::ostream & o, ProgramOptions const & options,
639 rtl::Reference< TypeManager > const & manager, OUString const & name)
640{
642 if (manager->getSort(name, &ent)
644 {
646 "unexpected entity \"" + name
647 + "\" in call to skeletonmaker::java::printConstructors");
648 }
650 dynamic_cast< unoidl::SingleInterfaceBasedServiceEntity * >(ent.get()));
651 assert(ent2.is());
652 for (const auto& rConstructor : ent2->getConstructors())
653 {
654 o << "static ";
655 printType(o, options, manager, ent2->getBase(), 1);
656 o << ' ';
657 if (rConstructor.defaultConstructor) {
658 o << "create";
659 } else {
661 u2b(rConstructor.name), "method");
662 }
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)
667 {
668 o << ", ";
669 printType(o, options, manager, rParam.type, 4);
670 o << ' '
672 u2b(rParam.name), "param");
673 }
674 o << ')';
675 printExceptionSpecification(o, options, manager, rConstructor.exceptions);
676 o << ";\n";
677 }
678}
679
681 std::ostream & o, ProgramOptions const & options,
682 rtl::Reference< TypeManager > const & manager,
683 OUString const & name,
685 OString const & delegate)
686{
687 assert(entity.is());
688 for (const auto& rService : entity->getDirectMandatoryBaseServices())
689 {
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";
693 }
694 for (const auto& rIface : entity->getDirectMandatoryBaseInterfaces())
695 {
696 o << "\n// supported interface " << rIface.name << "\n";
697 generateDocumentation(o, options, manager, u2b(rIface.name), delegate);
698 }
699 if (delegate.isEmpty()) {
700 o << "\n// properties of service \""<< name << "\"\n";
701 for (const auto& rProp : entity->getDirectProperties())
702 {
703 o << "// private ";
704 printType(o, options, manager, rProp.type, 1);
705 o << " "
707 u2b(rProp.name), "property")
708 << ";\n";
709 }
710 }
711}
712
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)
719{
720 o << "maps to C++ ";
721 if (cppTypeSort != nullptr)
722 o << cppTypeSort << ' ';
723
724 o << "type \"";
725 if (rank == 0 && nucleus == u"com.sun.star.uno.XInterface") {
726 o << "Reference< com::sun::star::uno::XInterface >";
727 } else {
728 printType(
729 o, options, manager, sort, nucleus, rank, arguments, entity, 0,
730 false);
731 }
732 o << '"';
733}
734
735void generateDocumentation(std::ostream & o,
736 ProgramOptions const & options, rtl::Reference< TypeManager > const & manager,
737 OString const & type, OString const & delegate)
738{
739 OUString nucleus;
740 sal_Int32 rank;
741 codemaker::UnoType::Sort sort = manager->decompose(
742 b2u(type), false, &nucleus, &rank, nullptr, nullptr);
743
744 bool comment = true;
745 if (!delegate.isEmpty()) {
749 {
750 return;
751 }
752 comment = false;
753 }
754
755 if (comment) {
756 o << "\n// UNO";
757 if (rank != 0) {
758 o << " sequence type";
759 } else if (sort <= codemaker::UnoType::Sort::Any) {
760 o << " simple type";
761 } else {
762 switch (sort) {
764 o << " interface type";
765 break;
766
768 o << "IDL module";
769 break;
770
772 o << " simple struct type";
773 break;
774
776 o << " polymorphic struct type template";
777 break;
778
780 o << " instantiated polymorphic struct type";
781 break;
782
784 o << " enum type";
785 break;
786
788 o << " exception type";
789 break;
790
792 o << "IDL typedef";
793 break;
794
796 o << " single-inheritance--based service";
797 break;
798
800 o << "IDL accumulation-based service";
801 break;
802
804 o << " inheritance-based singleton";
805 break;
806
808 o << "IDL service-based singleton";
809 break;
810
812 o << "IDL constant group";
813 break;
814
815 default:
816 OSL_ASSERT(false);
817 break;
818 }
819 }
820 o << " \"" << type << "\" ";
821 }
822 std::vector< OUString > arguments;
824 sort = manager->decompose(
825 b2u(type), true, &nucleus, &rank, &arguments, &entity);
826 if (rank != 0) {
827 if (comment) {
829 o, options, manager, sort, nucleus, rank, arguments, entity,
830 "array");
831 o << '\n';
832 }
833 } else if (sort <= codemaker::UnoType::Sort::Any) {
834 if (comment) {
836 o, options, manager, sort, nucleus, rank, arguments, entity, nullptr);
837 o << '\n';
838 }
839 } else {
840 switch (sort) {
842 if (comment)
844 o, options, manager, sort, nucleus, rank, arguments, entity,
845 "interface");
846 if (nucleus == "com.sun.star.uno.XInterface") {
847 if (comment)
848 o << '\n';
849 } else {
850 if (comment)
851 o << "; " << (options.all ? "all" : "direct") << " methods:\n";
852
855 o, options, manager, nucleus, generated, delegate,
856 options.implname, "");
857 }
858 break;
859
862 o, options, manager, sort, nucleus, rank, arguments, entity,
863 "namespace");
864 o << '\n';
865 break;
866
869 o, options, manager, sort, nucleus, rank, arguments, entity,
870 "class");
871 o << "; full constructor:\n";
874 entity, nucleus, arguments);
875 break;
876
879 o, options, manager, sort, nucleus, rank, arguments, entity,
880 "class template");
881 o << "; full constructor:\n";
883 o, options, manager,
885 entity, nucleus, arguments);
886 break;
887
890 o, options, manager, sort, nucleus, rank, arguments, entity,
891 "class template instantiation");
892 o << "; full constructor:\n";
894 o, options, manager,
896 entity, nucleus, arguments);
897 break;
898
901 o, options, manager, sort, nucleus, rank, arguments, entity,
902 "enum");
903 o << '\n';
904 break;
905
908 o, options, manager, sort, nucleus, rank, arguments, entity,
909 "namespace");
910 o << '\n';
911 break;
912
915 o, options, manager, sort, nucleus, rank, arguments, entity,
916 "exception class");
917 o << "; full constructor:\n";
920 entity, nucleus, arguments);
921 break;
922
924 if (comment) {
926 o, options, manager, sort, nucleus, rank, arguments, entity,
927 "class");
928 o << "; construction methods:\n";
929 printConstructors(o, options, manager, nucleus);
930 }
932 o, options, manager,
933 u2b(dynamic_cast<unoidl::SingleInterfaceBasedServiceEntity&>(*entity)
934 .getBase()),
935 delegate);
936 break;
937
939 if (comment)
940 o << ("does not map to C++\n"
941 "// the service members are generated instead\n");
943 o, options, manager, nucleus,
945 entity.get()),
946 delegate);
947 break;
948
951 o, options, manager, sort, nucleus, rank, arguments, entity,
952 "class");
953 o << "; get method:\nstatic ";
954 printType(
955 o, options, manager,
957 *entity).getBase(),
958 1);
959 o << " get(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & context);\n";
960 break;
961
963 o << "does not map to C++\n";
964 break;
965
966 default:
967 OSL_ASSERT(false);
968 break;
969 }
970 }
971}
972
973}
974
975
976/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XPropertyListType t
bool contains(OString const &type) const
void add(OString const &type)
rtl::Reference< ParseManager > manager
float u
const char * name
sal_uInt16 nPos
OString translateUnoToCppIdentifier(OString const &unoIdentifier, std::string_view prefix, IdentifierTranslationMode transmode, OString const *forbidden)
OString translateUnoToCppType(codemaker::UnoType::Sort sort, std::u16string_view nucleus)
OString scopedCppName(OString const &type, bool ns_alias)
OString convertString(OUString const &string)
int i
index
void generateXPropertyAccessBodies(std::ostream &o, const OString &classname, const OString &propertyhelper)
static void printSetPropertyMixinBody(std::ostream &o, unoidl::InterfaceTypeEntity::Attribute const &attribute)
static void printMapsToCppType(std::ostream &o, ProgramOptions const &options, rtl::Reference< TypeManager > const &manager, codemaker::UnoType::Sort sort, std::u16string_view nucleus, sal_Int32 rank, std::vector< OUString > const &arguments, rtl::Reference< unoidl::Entity > const &entity, const char *cppTypeSort)
static void printServiceMembers(std::ostream &o, ProgramOptions const &options, rtl::Reference< TypeManager > const &manager, OUString const &name, rtl::Reference< unoidl::AccumulationBasedServiceEntity > const &entity, OString const &delegate)
static bool printConstructorParameters(std::ostream &o, ProgramOptions const &options, rtl::Reference< TypeManager > const &manager, codemaker::UnoType::Sort sort, rtl::Reference< unoidl::Entity > const &entity, std::u16string_view name, std::vector< OUString > const &arguments)
void generateXCompatibilityNamesBodies(std::ostream &o, const OString &classname)
static void printType(std::ostream &o, ProgramOptions const &options, rtl::Reference< TypeManager > const &manager, codemaker::UnoType::Sort sort, std::u16string_view nucleus, sal_Int32 rank, std::vector< OUString > const &arguments, rtl::Reference< unoidl::Entity > const &entity, short referenceType, bool defaultvalue)
static void printConstructors(std::ostream &o, ProgramOptions const &options, rtl::Reference< TypeManager > const &manager, OUString const &name)
static void printConstructor(std::ostream &o, ProgramOptions const &options, rtl::Reference< TypeManager > const &manager, codemaker::UnoType::Sort sort, rtl::Reference< unoidl::Entity > const &entity, std::u16string_view name, std::vector< OUString > const &arguments)
void generateXInitialization(std::ostream &o, const OString &classname)
void generateXFastPropertySetBodies(std::ostream &o, const OString &classname, const OString &propertyhelper)
void generateXPropertySetBodies(std::ostream &o, const OString &classname, const OString &propertyhelper)
void generateXLocalizable(std::ostream &o, const OString &classname)
void generateDocumentation(std::ostream &o, ProgramOptions const &options, rtl::Reference< TypeManager > const &manager, OString const &type, OString const &delegate)
void generateXAddInBodies(std::ostream &o, const OString &classname)
void generateXDispatch(std::ostream &o, const OString &classname, const ProtocolCmdMap &protocolCmdMap)
void printMethods(std::ostream &o, ProgramOptions const &options, rtl::Reference< TypeManager > const &manager, OUString const &name, codemaker::GeneratedTypeSet &generated, OString const &delegate, OString const &classname, OString const &indentation, bool defaultvalue, OUString const &propertyhelper)
static void printExceptionSpecification(std::ostream &o, ProgramOptions const &options, rtl::Reference< TypeManager > const &manager, std::vector< OUString > const &exceptions)
static void printMethodParameters(std::ostream &o, ProgramOptions const &options, rtl::Reference< TypeManager > const &manager, std::vector< unoidl::InterfaceTypeEntity::Method::Parameter > const &parameters, bool withType)
void generateXDispatchProvider(std::ostream &o, const OString &classname, const ProtocolCmdMap &protocolCmdMap)
unoidl::AccumulationBasedServiceEntity::Property::Attributes checkAdditionalPropertyFlags(unoidl::InterfaceTypeEntity::Attribute const &attribute)
sal_Int32 attribute
OUString b2u(std::string_view s)
OString u2b(std::u16string_view s)
ResultType type