summaryrefslogtreecommitdiff
path: root/codemaker
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2014-04-14 13:56:15 +0200
committerJan Holesovsky <kendy@collabora.com>2014-04-14 15:46:22 +0200
commit2188a7ac2eb37aee89f8f305bdf99db9b05b20bf (patch)
tree150fbb6aa7d1097da4a5c078c72645c40ee46554 /codemaker
parent141a87dd3caeefc7d098dbf4d1a6df2f0cb259c5 (diff)
Reduce the amount of strings in the release builds.
I guess even in the debug builds these strings do not add much info, but... Change-Id: I5cf765539a821513b5ce77c5484071d181459881
Diffstat (limited to 'codemaker')
-rw-r--r--codemaker/source/cppumaker/cpputype.cxx45
1 files changed, 22 insertions, 23 deletions
diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx
index 06617bf86669..3ffceb2ec5bd 100644
--- a/codemaker/source/cppumaker/cpputype.cxx
+++ b/codemaker/source/cppumaker/cpputype.cxx
@@ -3344,6 +3344,17 @@ private:
rtl::Reference< unoidl::SingleInterfaceBasedServiceEntity > entity_;
};
+static OUString failsToSupply(const OUString& name_, const OString& baseName)
+{
+ return OUString(
+ "\n"
+ "#if OSL_DEBUG_LEVEL > 0\n"
+ " ::rtl::OUString(\"component context fails to supply service '" + name_ + "' of type '" + OStringToOUString(baseName, RTL_TEXTENCODING_UTF8) + "'\")\n"
+ "#else\n"
+ " ::rtl::OUString(\"service not supplied\")\n"
+ "#endif\n");
+}
+
void ServiceType::dumpHxxFile(
FileStream & o, codemaker::cppumaker::Includes & includes)
{
@@ -3480,24 +3491,16 @@ void ServiceType::dumpHxxFile(
<< ("} catch (const ::css::uno::Exception & the_exception) {\n");
inc();
o << indent()
- << ("throw ::css::uno::DeploymentException("
- "::rtl::OUString( "
- "\"component context fails to supply service \" ) + ")
- << "\"" << name_ << "\" + "
- << "\" of type \" + "
- << "\"" << baseName << "\" + "
- << "\": \" + the_exception.Message, the_context);\n";
+ << "throw ::css::uno::DeploymentException("
+ << failsToSupply(name_, baseName)
+ << " + \": \" + the_exception.Message, the_context);\n";
dec();
o << indent() << "}\n" << indent()
<< "if (!the_instance.is()) {\n";
inc();
o << indent()
- << ("throw ::css::uno::DeploymentException("
- "::rtl::OUString( "
- "\"component context fails to supply service \" ) + ")
- << "\"" << name_ << "\" + "
- << "\" of type \" + "
- << "\"" << baseName << "\""
+ << "throw ::css::uno::DeploymentException("
+ << failsToSupply(name_, baseName)
<< ", the_context);\n";
dec();
o << indent() << "}\n" << indent() << "return the_instance;\n";
@@ -3649,22 +3652,18 @@ void ServiceType::dumpHxxFile(
" the_exception) {\n");
inc();
o << indent()
- << ("throw ::css::uno::DeploymentException("
- "::rtl::OUString( "
- "\"component context fails to supply service ")
- << name_ << " of type " << baseName
- << ": \" ) + the_exception.Message, the_context);\n";
+ << "throw ::css::uno::DeploymentException("
+ << failsToSupply(name_, baseName)
+ << " + \": \" + the_exception.Message, the_context);\n";
dec();
o << indent() << "}\n";
}
o << indent() << "if (!the_instance.is()) {\n";
inc();
o << indent()
- << ("throw ::css::uno::DeploymentException("
- "::rtl::OUString( "
- "\"component context fails to supply service ")
- << name_ << " of type " << baseName
- << "\" ), the_context);\n";
+ << "throw ::css::uno::DeploymentException("
+ << failsToSupply(name_, baseName)
+ << ", the_context);\n";
dec();
o << indent() << "}\n" << indent() << "return the_instance;\n";
dec();