Update to m13
[ooovba.git] / applied_patches / 0798-codemaker-function-template-generators.diff
blob451fda133b13a120093f80db8cacf4b1fc2ce445
1 diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx
2 index 69fa71a..5da6316 100644
3 --- codemaker/source/cppumaker/cpputype.cxx
4 +++ codemaker/source/cppumaker/cpputype.cxx
5 @@ -2389,7 +2389,7 @@ sal_Bool StructureType::dumpDeclaration(FileStream& o)
6 o << " {\n";
7 inc();
8 o << indent() << "inline " << m_name << "() SAL_THROW(());\n";
9 - sal_uInt16 members = m_reader.getFieldCount();
10 + const sal_uInt16 members = m_reader.getFieldCount();
11 if (members > 0 || getInheritedMemberCount() > 0) {
12 o << "\n" << indent() << "inline " << m_name << "(";
13 bool prev = dumpSuperMember(o, base, true);
14 @@ -2445,6 +2445,58 @@ sal_Bool StructureType::dumpDeclaration(FileStream& o)
15 dec();
16 o << "};\n\n";
18 + if (isPolymorphic() && (members > 0 || getInheritedMemberCount() > 0)) {
19 + o << indent();
20 + dumpTemplateHead(o);
21 + o << "\n";
22 + o << indent();
23 + o << "inline " << m_name;
24 + dumpTemplateParameters(o);
25 + o << "\n";
26 + o << indent();
27 + o << "make_" << m_name << "(";
28 + bool prev = dumpSuperMember(o, base, true);
29 + for (sal_uInt16 i = 0; i < members; ++i) {
30 + if (prev) {
31 + o << ", ";
32 + }
33 + prev = true;
34 + rtl::OString type(
35 + rtl::OUStringToOString(
36 + m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8));
37 + if ((m_reader.getFieldFlags(i) & RT_ACCESS_PARAMETERIZED_TYPE) != 0)
38 + {
39 + dumpTypeParameterName(o, type);
40 + o << " const &";
41 + } else {
42 + dumpType(o, type, true, true);
43 + }
44 + o << " "
45 + << rtl::OUStringToOString(
46 + m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8);
47 + }
48 + o << ") SAL_THROW(())\n";
49 + o << indent() << "{\n";
50 + inc();
51 + o << indent() << "return " << m_name;
52 + dumpTemplateParameters(o);
53 + o << "(\n";
54 + inc();
55 + prev = dumpSuperMember(o, base, false);
56 + for (sal_uInt16 i = 0; i < members; ++i) {
57 + if (prev) {
58 + o << ",\n";
59 + }
60 + prev = true;
61 + o << indent() << rtl::OUStringToOString(
62 + m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8);
63 + }
64 + o << ");\n";
65 + dec();
66 + dec();
67 + o << indent() << "}\n\n";
68 + }
70 o << "#ifdef SAL_W32\n"
71 << "# pragma pack(pop)\n"
72 << "#elif defined(SAL_OS2)\n"
73 diff --git a/codemaker/test/cppumaker/test_codemaker_cppumaker.cxx b/codemaker/test/cppumaker/test_codemaker_cppumaker.cxx
74 index 2d5e638..94f8569 100644
75 --- codemaker/test/cppumaker/test_codemaker_cppumaker.cxx
76 +++ codemaker/test/cppumaker/test_codemaker_cppumaker.cxx
77 @@ -444,10 +444,16 @@ void Test::testBigStruct() {
78 CPPUNIT_ASSERT_EQUAL(guard.p->m22.getLength(), static_cast< sal_Int32 >(0));
79 CPPUNIT_ASSERT_EQUAL(guard.p->m23.getLength(), static_cast< sal_Int32 >(0));
81 -#if defined __GNUC__ && __GNUC__ >= 3
82 +#if defined(__GNUC__) && __GNUC__ >= 3
83 +# if !defined(X86_64)
84 CPPUNIT_ASSERT_EQUAL(
85 static_cast< std::size_t >(16),
86 sizeof (test::codemaker::cppumaker::AlignmentDerivedStruct));
87 +# else
88 + CPPUNIT_ASSERT_EQUAL(
89 + static_cast< std::size_t >(24),
90 + sizeof (test::codemaker::cppumaker::AlignmentDerivedStruct));
91 +# endif
92 #endif
94 com::sun::star::uno::Type t(
95 diff --git a/codemaker/test/cppumaker/types.idl b/codemaker/test/cppumaker/types.idl
96 index 972f579..962aca8 100644
97 --- codemaker/test/cppumaker/types.idl
98 +++ codemaker/test/cppumaker/types.idl
99 @@ -28,8 +28,6 @@
101 ************************************************************************/
103 -//TODO: Do not depend on types for which C++ header files are only generated
104 -// later in the build process in offuh:
105 #include "com/sun/star/lang/ClassNotFoundException.idl"
106 #include "com/sun/star/lang/IllegalAccessException.idl"
107 #include "com/sun/star/lang/Locale.idl"