summaryrefslogtreecommitdiff
path: root/codemaker
diff options
context:
space:
mode:
Diffstat (limited to 'codemaker')
-rw-r--r--codemaker/source/commonjava/commonjava.cxx2
-rw-r--r--codemaker/source/cppumaker/cpputype.cxx55
-rw-r--r--codemaker/source/javamaker/javatype.cxx25
3 files changed, 66 insertions, 16 deletions
diff --git a/codemaker/source/commonjava/commonjava.cxx b/codemaker/source/commonjava/commonjava.cxx
index 955a0ba5e7cd..bdb1b02b63a7 100644
--- a/codemaker/source/commonjava/commonjava.cxx
+++ b/codemaker/source/commonjava/commonjava.cxx
@@ -39,7 +39,7 @@ namespace codemaker { namespace java {
OString translateUnoToJavaType(
codemaker::UnoType::Sort sort, OString const & nucleus, bool referenceType)
{
- OStringBuffer buf;
+ OStringBuffer buf(128);
if (sort <= codemaker::UnoType::Sort::Any) {
OString const javaTypes[static_cast<int>(codemaker::UnoType::Sort::Any) + 1][2] = {
{ "void", "java/lang/Void" },
diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx
index a16256d4c353..dcec84ccdc3f 100644
--- a/codemaker/source/cppumaker/cpputype.cxx
+++ b/codemaker/source/cppumaker/cpputype.cxx
@@ -2400,6 +2400,28 @@ void PolyStructType::dumpLightGetCppuType(FileStream & out)
<< "static ::typelib_TypeDescriptionReference * the_type = 0;\n"
<< indent() << "if (the_type == 0) {\n";
inc();
+
+ out << "#ifdef LIBO_INTERNAL_ONLY\n";
+
+ out << indent() << "::rtl::OString the_buffer = \"" << name_
+ << "<\" +\n";
+ for (std::vector< OUString >::const_iterator i(
+ entity_->getTypeParameters().begin());
+ i != entity_->getTypeParameters().end();) {
+ out << indent()
+ << ("::rtl::OUStringToOString("
+ "::cppu::getTypeFavourChar(static_cast< ");
+ dumpTypeParameterName(out, *i);
+ out << " * >(0)).getTypeName(), RTL_TEXTENCODING_UTF8) +\n";
+ ++i;
+ if (i != entity_->getTypeParameters().end()) {
+ out << indent() << "\",\" +\n";
+ }
+ }
+ out << indent() << "\">\";\n";
+
+ out << "#else\n";
+
out << indent() << "::rtl::OStringBuffer the_buffer(\"" << name_
<< "<\");\n";
for (std::vector< OUString >::const_iterator i(
@@ -2415,9 +2437,14 @@ void PolyStructType::dumpLightGetCppuType(FileStream & out)
out << indent() << "the_buffer.append(',');\n";
}
}
- out << indent() << "the_buffer.append('>');\n" << indent()
+ out << indent() << "the_buffer.append('>');\n";
+
+ out << "#endif\n";
+
+ out << indent()
<< "::typelib_static_type_init(&the_type, " << getTypeClass(name_, true)
<< ", the_buffer.getStr());\n";
+
dec();
out << indent() << "}\n" << indent()
<< "return *reinterpret_cast< ::css::uno::Type * >(&the_type);\n";
@@ -2506,6 +2533,27 @@ void PolyStructType::dumpComprehensiveGetCppuType(FileStream & out)
out << indent() << "::css::uno::Type * operator()() const\n"
<< indent() << "{\n";
inc();
+
+ out << "#ifdef LIBO_INTERNAL_ONLY\n";
+ out << indent()
+ << "::rtl::OUString the_name =\n";
+ out << indent() << "\"" << name_ << "<\" +\n";
+ for (std::vector< OUString >::const_iterator i(
+ entity_->getTypeParameters().begin());
+ i != entity_->getTypeParameters().end();) {
+ out << indent()
+ << "::cppu::getTypeFavourChar(static_cast< ";
+ dumpTypeParameterName(out, *i);
+ out << " * >(0)).getTypeName() +\n";
+ ++i;
+ if (i != entity_->getTypeParameters().end()) {
+ out << indent()
+ << "\",\" +\n";
+ }
+ }
+ out << indent()
+ << "\">\";\n";
+ out << "#else\n";
out << indent() << "::rtl::OUStringBuffer the_buffer;\n" << indent()
<< "the_buffer.append(\"" << name_ << "<\");\n";
for (std::vector< OUString >::const_iterator i(
@@ -2522,9 +2570,10 @@ void PolyStructType::dumpComprehensiveGetCppuType(FileStream & out)
"static_cast< ::sal_Unicode >(','));\n");
}
}
- out << indent() << "the_buffer.append(static_cast< ::sal_Unicode >('>'));\n"
- << indent()
+ out << indent() << "the_buffer.append(static_cast< ::sal_Unicode >('>'));\n";
+ out << indent()
<< "::rtl::OUString the_name(the_buffer.makeStringAndClear());\n";
+ out << "#endif\n";
std::map< OUString, sal_uInt32 > parameters;
std::map< OUString, sal_uInt32 > types;
std::vector< unoidl::PolymorphicStructTypeTemplateEntity::Member >::
diff --git a/codemaker/source/javamaker/javatype.cxx b/codemaker/source/javamaker/javatype.cxx
index 0616d8f08771..16c2ef73e089 100644
--- a/codemaker/source/javamaker/javatype.cxx
+++ b/codemaker/source/javamaker/javatype.cxx
@@ -89,7 +89,7 @@ OUString createUnoName(
rtl::Reference< TypeManager > const & manager, OUString const & nucleus,
sal_Int32 rank, std::vector< OUString > const & arguments)
{
- OUStringBuffer buf;
+ OUStringBuffer buf(256);
appendUnoName(manager, nucleus, rank, arguments, &buf);
return buf.makeStringAndClear();
}
@@ -293,8 +293,8 @@ SpecialType getFieldDescriptor(
PolymorphicUnoType * polymorphicUnoType)
{
assert(descriptor != nullptr);
- OStringBuffer desc;
- OStringBuffer sig;
+ OStringBuffer desc(64);
+ OStringBuffer sig(64);
bool needsSig = false;
SpecialType specialType = translateUnoTypeToDescriptor(
manager, type, false, false, dependencies, &desc, &sig, &needsSig,
@@ -331,9 +331,9 @@ public:
private:
rtl::Reference< TypeManager > m_manager;
std::set<OUString> * m_dependencies;
- OStringBuffer m_descriptorStart;
+ OStringBuffer m_descriptorStart{16*1024};
OString m_descriptorEnd;
- OStringBuffer m_signatureStart;
+ OStringBuffer m_signatureStart{16*1024};
OString m_signatureEnd;
bool m_needsSignature;
};
@@ -347,9 +347,9 @@ MethodDescriptor::MethodDescriptor(
assert(dependencies != nullptr);
m_descriptorStart.append('(');
m_signatureStart.append('(');
- OStringBuffer descEnd;
+ OStringBuffer descEnd(128);
descEnd.append(')');
- OStringBuffer sigEnd;
+ OStringBuffer sigEnd(128);
sigEnd.append(')');
SpecialType special = translateUnoTypeToDescriptor(
m_manager, returnType, false, false, m_dependencies, &descEnd, &sigEnd,
@@ -896,7 +896,7 @@ sal_uInt16 addFieldInit(
dynamic_cast< unoidl::EnumTypeEntity * >(ent.get()));
assert(ent2.is());
code->loadLocalReference(0);
- OStringBuffer descBuf;
+ OStringBuffer descBuf(128);
translateUnoTypeToDescriptor(
manager, sort, nucleus, 0, std::vector< OUString >(), false,
false, dependencies, &descBuf, nullptr, nullptr, nullptr);
@@ -917,7 +917,7 @@ sal_uInt16 addFieldInit(
code->instrInvokespecial(
codemaker::convertString(nucleus).replace('.', '/'),
"<init>", "()V");
- OStringBuffer desc;
+ OStringBuffer desc(128);
translateUnoTypeToDescriptor(
manager, sort, nucleus, 0, args, false, false, dependencies,
&desc, nullptr, nullptr, nullptr);
@@ -947,13 +947,13 @@ sal_uInt16 addFieldInit(
false));
}
} else {
- OStringBuffer desc;
+ OStringBuffer desc(128);
translateUnoTypeToDescriptor(
manager, sort, nucleus, rank - 1, std::vector< OUString >(), false,
false, dependencies, &desc, nullptr, nullptr, nullptr);
code->instrAnewarray(desc.makeStringAndClear());
}
- OStringBuffer desc;
+ OStringBuffer desc(128);
translateUnoTypeToDescriptor(
manager, sort, nucleus, rank, std::vector< OUString >(), false, false,
dependencies, &desc, nullptr, nullptr, nullptr);
@@ -1440,7 +1440,8 @@ void handlePolyStructType(
assert(entity.is());
OString className(codemaker::convertString(name).replace('.', '/'));
std::map< OUString, sal_Int32 > typeParameters;
- OStringBuffer sig("<");
+ OStringBuffer sig(128);
+ sig.append("<");
sal_Int32 index = 0;
for (const OUString& param : entity->getTypeParameters())
{