summaryrefslogtreecommitdiff
path: root/unodevtools
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-04-05 11:41:39 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2019-04-05 16:13:14 +0200
commitdacde2c0394d33a04bc9ad929df394465c14b093 (patch)
tree6669725646ddcf2bbf467b9dfb8c9739fe05139f /unodevtools
parentd33b3efa90bed4f317c872b1c2b83696cdedaa26 (diff)
Revert "Get rid of b2u/u2b helpers; use OUString's toUtf8/fromUtf8 instead"
This reverts commit 84662e9030a855c8db7cd40d9ce354b773d78c16. Change-Id: I1cc98d3201390609ae3615baa8e92c926cdcde9a Reviewed-on: https://gerrit.libreoffice.org/70294 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'unodevtools')
-rw-r--r--unodevtools/source/skeletonmaker/cppcompskeleton.cxx18
-rw-r--r--unodevtools/source/skeletonmaker/cpptypemaker.cxx59
-rw-r--r--unodevtools/source/skeletonmaker/javacompskeleton.cxx18
-rw-r--r--unodevtools/source/skeletonmaker/javatypemaker.cxx40
-rw-r--r--unodevtools/source/skeletonmaker/skeletoncommon.cxx6
5 files changed, 70 insertions, 71 deletions
diff --git a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
index e4f64a9648e6..097115d94879 100644
--- a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
+++ b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
@@ -625,7 +625,7 @@ static OString generateClassDefinition(std::ostream& o,
std::set< OUString >::const_iterator iter = interfaces.begin();
while (iter != interfaces.end())
{
- o << "\n " << scopedCppName(iter->toUtf8());
+ o << "\n " << scopedCppName(u2b(*iter));
++iter;
if (iter != interfaces.end())
o << ",";
@@ -636,7 +636,7 @@ static OString generateClassDefinition(std::ostream& o,
if (propertyhelper.getLength() > 1) {
o << ",\n public ::cppu::PropertySetMixin< "
- << scopedCppName(propertyhelper.toUtf8()) << " >";
+ << scopedCppName(u2b(propertyhelper)) << " >";
}
o << "\n{\npublic:\n"
@@ -665,7 +665,7 @@ static OString generateClassDefinition(std::ostream& o,
std::set< OUString >::const_iterator iter = interfaces.begin();
while (iter != interfaces.end())
{
- buffer.append(scopedCppName(iter->toUtf8()));
+ buffer.append(scopedCppName(u2b(*iter)));
++iter;
if (iter != interfaces.end())
buffer.append(", ");
@@ -771,7 +771,7 @@ static OString generateClassDefinition(std::ostream& o,
o << " ::cppu::WeakComponentImplHelper" << interfaces.size() << "<";
std::set< OUString >::const_iterator iter = interfaces.begin();
while (iter != interfaces.end()) {
- o << "\n " << scopedCppName(iter->toUtf8());
+ o << "\n " << scopedCppName(u2b(*iter));
++iter;
if (iter != interfaces.end())
o << ",";
@@ -781,7 +781,7 @@ static OString generateClassDefinition(std::ostream& o,
}
if (propertyhelper.getLength() > 1) {
o << " ::cppu::PropertySetMixin< "
- << scopedCppName(propertyhelper.toUtf8()) << " >(\n"
+ << scopedCppName(u2b(propertyhelper)) << " >(\n"
" context, static_cast< Implements >(\n ";
OStringBuffer buffer(128);
if (propinterfaces.find("com/sun/star/beans/XPropertySet")
@@ -865,7 +865,7 @@ static void generateMethodBodies(std::ostream& o,
for (const auto& rIface : interfaces) {
if ( rIface == "com.sun.star.lang.XServiceInfo" ) {
generateXServiceInfoBodies(o, name, comphelpernamespace);
- generated.add(rIface.toUtf8());
+ generated.add(u2b(rIface));
} else {
printMethods(o, options, manager, rIface, generated, "_",
name, "", true, propertyhelper);
@@ -897,7 +897,7 @@ static void generateQueryInterface(std::ostream& o,
std::set< OUString >::const_iterator iter = interfaces.begin();
while (iter != interfaces.end())
{
- o << "\n " << scopedCppName(iter->toUtf8());
+ o << "\n " << scopedCppName(u2b(*iter));
++iter;
if (iter != interfaces.end())
o << ",";
@@ -940,7 +940,7 @@ void generateSkeleton(ProgramOptions const & options,
bool supportxcomponent = false;
for (const auto& rType : types) {
- checkType(manager, OUString::fromUtf8(rType), interfaces, services, properties);
+ checkType(manager, b2u(rType), interfaces, services, properties);
}
if (options.componenttype == 3) {
@@ -1071,7 +1071,7 @@ void generateCalcAddin(ProgramOptions const & options,
for (const auto& rType : types) {
- checkType(manager, OUString::fromUtf8(rType), interfaces, services, properties);
+ checkType(manager, b2u(rType), interfaces, services, properties);
}
OUString sAddinService;
diff --git a/unodevtools/source/skeletonmaker/cpptypemaker.cxx b/unodevtools/source/skeletonmaker/cpptypemaker.cxx
index 5f9ed159ac8d..f5da4810edd7 100644
--- a/unodevtools/source/skeletonmaker/cpptypemaker.cxx
+++ b/unodevtools/source/skeletonmaker/cpptypemaker.cxx
@@ -168,7 +168,7 @@ static bool printConstructorParameters(
printType(o, options, manager, rMember.type, 4);
o << ' '
<< codemaker::cpp::translateUnoToCppIdentifier(
- rMember.name.toUtf8(), "param");
+ u2b(rMember.name), "param");
}
break;
}
@@ -191,7 +191,7 @@ static bool printConstructorParameters(
}
o << ' '
<< codemaker::cpp::translateUnoToCppIdentifier(
- rMember.name.toUtf8(), "param");
+ u2b(rMember.name), "param");
}
break;
}
@@ -218,7 +218,7 @@ static bool printConstructorParameters(
}
o << ' '
<< codemaker::cpp::translateUnoToCppIdentifier(
- rMember.name.toUtf8(), "param");
+ u2b(rMember.name), "param");
}
break;
}
@@ -244,7 +244,7 @@ static bool printConstructorParameters(
printType(o, options, manager, rMember.type, 4);
o << ' '
<< codemaker::cpp::translateUnoToCppIdentifier(
- rMember.name.toUtf8(), "param");
+ u2b(rMember.name), "param");
}
break;
}
@@ -295,7 +295,7 @@ static void printMethodParameters(
printType(o, options, manager, i->type, referenceType);
o << ' ';
}
- o << codemaker::cpp::translateUnoToCppIdentifier(i->name.toUtf8(), "param");
+ o << codemaker::cpp::translateUnoToCppIdentifier(u2b(i->name), "param");
}
}
@@ -405,7 +405,7 @@ void printMethods(std::ostream & o,
OString const & indentation, bool defaultvalue,
OUString const & propertyhelper)
{
- if (generated.contains(name.toUtf8()) || name == "com.sun.star.uno.XInterface" ||
+ if (generated.contains(u2b(name)) || name == "com.sun.star.uno.XInterface" ||
(defaultvalue &&
( name == "com.sun.star.lang.XComponent" ||
name == "com.sun.star.lang.XTypeProvider" ||
@@ -420,19 +420,19 @@ void printMethods(std::ostream & o,
if (body && propertyhelper.getLength() > 1) {
if (name == "com.sun.star.beans.XPropertySet") {
- generated.add(name.toUtf8());
+ generated.add(u2b(name));
generateXPropertySetBodies(
- o, classname, scopedCppName(propertyhelper.toUtf8()));
+ o, classname, scopedCppName(u2b(propertyhelper)));
return;
} else if (name == "com.sun.star.beans.XFastPropertySet") {
- generated.add(name.toUtf8());
+ generated.add(u2b(name));
generateXFastPropertySetBodies(
- o, classname, scopedCppName(propertyhelper.toUtf8()));
+ o, classname, scopedCppName(u2b(propertyhelper)));
return;
} else if (name == "com.sun.star.beans.XPropertyAccess") {
- generated.add(name.toUtf8());
+ generated.add(u2b(name));
generateXPropertyAccessBodies(
- o, classname, scopedCppName(propertyhelper.toUtf8()));
+ o, classname, scopedCppName(u2b(propertyhelper)));
return;
}
}
@@ -444,11 +444,11 @@ void printMethods(std::ostream & o,
"throw (css::uno::RuntimeException)\n{\n "
"return OUString("
"sADDIN_SERVICENAME);\n}\n";
- generated.add(name.toUtf8());
+ generated.add(u2b(name));
return;
} else if (name == "com.sun.star.sheet.XAddIn") {
generateXAddInBodies(o, classname);
- generated.add(name.toUtf8());
+ generated.add(u2b(name));
// special handling of XLocalizable -> parent of XAddIn
if (!generated.contains("com.sun.star.lang.XLocalizable")) {
@@ -458,11 +458,11 @@ void printMethods(std::ostream & o,
return;
} else if (name == "com.sun.star.lang.XLocalizable") {
generateXLocalizable(o, classname);
- generated.add(name.toUtf8());
+ generated.add(u2b(name));
return;
} else if (name == "com.sun.star.sheet.XCompatibilityNames") {
generateXCompatibilityNamesBodies(o, classname);
- generated.add(name.toUtf8());
+ generated.add(u2b(name));
return;
}
}
@@ -470,20 +470,20 @@ void printMethods(std::ostream & o,
if (body && options.componenttype == 3) {
if (name == "com.sun.star.lang.XInitialization") {
generateXInitialization(o, classname);
- generated.add(name.toUtf8());
+ generated.add(u2b(name));
return;
} else if (name == "com.sun.star.frame.XDispatch") {
generateXDispatch(o, classname, options.protocolCmdMap);
- generated.add(name.toUtf8());
+ generated.add(u2b(name));
return;
} else if (name == "com.sun.star.frame.XDispatchProvider") {
generateXDispatchProvider(o, classname, options.protocolCmdMap);
- generated.add(name.toUtf8());
+ generated.add(u2b(name));
return;
}
}
- generated.add(name.toUtf8());
+ generated.add(u2b(name));
rtl::Reference< unoidl::Entity > ent;
if (manager->getSort(name, &ent) != codemaker::UnoType::Sort::Interface)
{
@@ -657,7 +657,7 @@ static void printConstructors(
o << "create";
} else {
o << codemaker::cpp::translateUnoToCppIdentifier(
- rConstructor.name.toUtf8(), "method");
+ u2b(rConstructor.name), "method");
}
o << ((options.shortnames) ? "(css::uno::Reference< css" :
"(::com::sun::star::uno::Reference< ::com::sun::star")
@@ -668,7 +668,7 @@ static void printConstructors(
printType(o, options, manager, rParam.type, 4);
o << ' '
<< codemaker::cpp::translateUnoToCppIdentifier(
- rParam.name.toUtf8(), "param");
+ u2b(rParam.name), "param");
}
o << ')';
printExceptionSpecification(o, options, manager, rConstructor.exceptions);
@@ -687,13 +687,13 @@ static void printServiceMembers(
for (const auto& rService : entity->getDirectMandatoryBaseServices())
{
o << "\n// exported service " << rService.name << "\n";
- generateDocumentation(o, options, manager, rService.name.toUtf8(), delegate);
+ generateDocumentation(o, options, manager, u2b(rService.name), delegate);
o << "\n// end of exported service " << rService.name << "\n";
}
for (const auto& rIface : entity->getDirectMandatoryBaseInterfaces())
{
o << "\n// supported interface " << rIface.name << "\n";
- generateDocumentation(o, options, manager, rIface.name.toUtf8(), delegate);
+ generateDocumentation(o, options, manager, u2b(rIface.name), delegate);
}
if (delegate.isEmpty()) {
o << "\n// properties of service \""<< name << "\"\n";
@@ -703,7 +703,7 @@ static void printServiceMembers(
printType(o, options, manager, rProp.type, 1);
o << " "
<< codemaker::cpp::translateUnoToCppIdentifier(
- rProp.name.toUtf8(), "property")
+ u2b(rProp.name), "property")
<< ";\n";
}
}
@@ -738,7 +738,7 @@ void generateDocumentation(std::ostream & o,
OUString nucleus;
sal_Int32 rank;
codemaker::UnoType::Sort sort = manager->decompose(
- OUString::fromUtf8(type), false, &nucleus, &rank, nullptr, nullptr);
+ b2u(type), false, &nucleus, &rank, nullptr, nullptr);
bool comment = true;
if (!delegate.isEmpty()) {
@@ -821,7 +821,7 @@ void generateDocumentation(std::ostream & o,
std::vector< OUString > arguments;
rtl::Reference< unoidl::Entity > entity;
sort = manager->decompose(
- OUString::fromUtf8(type), true, &nucleus, &rank, &arguments, &entity);
+ b2u(type), true, &nucleus, &rank, &arguments, &entity);
if (rank != 0) {
if (comment) {
printMapsToCppType(
@@ -929,9 +929,8 @@ void generateDocumentation(std::ostream & o,
}
generateDocumentation(
o, options, manager,
- dynamic_cast<unoidl::SingleInterfaceBasedServiceEntity&>(*entity.get())
- .getBase()
- .toUtf8(),
+ u2b(dynamic_cast<unoidl::SingleInterfaceBasedServiceEntity&>(*entity.get())
+ .getBase()),
delegate);
break;
diff --git a/unodevtools/source/skeletonmaker/javacompskeleton.cxx b/unodevtools/source/skeletonmaker/javacompskeleton.cxx
index cf6f6c5f1304..741387cfe120 100644
--- a/unodevtools/source/skeletonmaker/javacompskeleton.cxx
+++ b/unodevtools/source/skeletonmaker/javacompskeleton.cxx
@@ -495,18 +495,18 @@ static void generateMethodBodies(std::ostream& o,
for (const OUString& type : interfaces) {
if (type == "com.sun.star.lang.XServiceInfo") {
generateXServiceInfoBodies(o);
- generated.add(type.toUtf8());
+ generated.add(u2b(type));
} else {
if (options.componenttype == 2) {
if (type == "com.sun.star.lang.XServiceName") {
o << " // com.sun.star.lang.XServiceName:\n"
" public String getServiceName() {\n"
" return sADDIN_SERVICENAME;\n }\n";
- generated.add(type.toUtf8());
+ generated.add(u2b(type));
continue;
} else if (type == "com.sun.star.sheet.XAddIn") {
generateXAddInBodies(o);
- generated.add(type.toUtf8());
+ generated.add(u2b(type));
// special handling of XLocalizable -> parent of XAddIn
if (!generated.contains("com.sun.star.lang.XLocalizable")) {
@@ -516,26 +516,26 @@ static void generateMethodBodies(std::ostream& o,
continue;
} else if (type == "com.sun.star.lang.XLocalizable") {
generateXLocalizableBodies(o);
- generated.add(type.toUtf8());
+ generated.add(u2b(type));
continue;
} else if (type == "com.sun.star.sheet.XCompatibilityNames") {
generateXCompatibilityNamesBodies(o);
- generated.add(type.toUtf8());
+ generated.add(u2b(type));
continue;
}
}
if (options.componenttype == 3) {
if (type == "com.sun.star.lang.XInitialization") {
generateXInitializationBodies(o);
- generated.add(type.toUtf8());
+ generated.add(u2b(type));
continue;
} else if (type == "com.sun.star.frame.XDispatch") {
generateXDispatchBodies(o, options);
- generated.add(type.toUtf8());
+ generated.add(u2b(type));
continue;
} else if (type == "com.sun.star.frame.XDispatchProvider") {
generateXDispatchProviderBodies(o, options);
- generated.add(type.toUtf8());
+ generated.add(u2b(type));
continue;
}
}
@@ -812,7 +812,7 @@ void generateSkeleton(ProgramOptions const & options,
bool supportxcomponent = false;
for (const auto& rType : types) {
- checkType(manager, OUString::fromUtf8(rType), interfaces, services, properties);
+ checkType(manager, b2u(rType), interfaces, services, properties);
}
if (options.componenttype == 3) {
diff --git a/unodevtools/source/skeletonmaker/javatypemaker.cxx b/unodevtools/source/skeletonmaker/javatypemaker.cxx
index a9575810b744..4cf3fd677822 100644
--- a/unodevtools/source/skeletonmaker/javatypemaker.cxx
+++ b/unodevtools/source/skeletonmaker/javatypemaker.cxx
@@ -77,7 +77,7 @@ static void printType(
OString sType(
codemaker::java::translateUnoToJavaType(
- sort, nucleus.toUtf8(), referenceType && rank == 0));
+ sort, u2b(nucleus), referenceType && rank == 0));
if (sType.startsWith("java.lang.")) {
sType = sType.copy(std::strlen("java.lang."));
}
@@ -155,7 +155,7 @@ static bool printConstructorParameters(
printType(o, options, manager, rMember.type, false);
o << ' '
<< codemaker::java::translateUnoToJavaIdentifier(
- rMember.name.toUtf8(), "param");
+ u2b(rMember.name), "param");
}
break;
}
@@ -178,7 +178,7 @@ static bool printConstructorParameters(
}
o << ' '
<< codemaker::java::translateUnoToJavaIdentifier(
- rMember.name.toUtf8(), "param");
+ u2b(rMember.name), "param");
}
break;
}
@@ -205,7 +205,7 @@ static bool printConstructorParameters(
}
o << ' '
<< codemaker::java::translateUnoToJavaIdentifier(
- rMember.name.toUtf8(), "param");
+ u2b(rMember.name), "param");
}
break;
}
@@ -231,7 +231,7 @@ static bool printConstructorParameters(
printType(o, options, manager, rMember.type, false);
o << ' '
<< codemaker::java::translateUnoToJavaIdentifier(
- rMember.name.toUtf8(), "param");
+ u2b(rMember.name), "param");
}
break;
}
@@ -280,7 +280,7 @@ static void printMethodParameters(
o << ' ';
}
o << codemaker::java::translateUnoToJavaIdentifier(
- i->name.toUtf8(), "param");
+ u2b(i->name), "param");
}
}
@@ -397,7 +397,7 @@ void printMethods(std::ostream & o,
OString const & delegate, OString const & indentation,
bool defaultvalue, bool usepropertymixin)
{
- if ( generated.contains(name.toUtf8()) || name == "com.sun.star.uno.XInterface" ||
+ if ( generated.contains(u2b(name)) || name == "com.sun.star.uno.XInterface" ||
( defaultvalue &&
( name == "com.sun.star.lang.XComponent" ||
name == "com.sun.star.lang.XTypeProvider" ||
@@ -407,15 +407,15 @@ void printMethods(std::ostream & o,
if ( usepropertymixin ) {
if (name == "com.sun.star.beans.XPropertySet") {
- generated.add(name.toUtf8());
+ generated.add(u2b(name));
generateXPropertySetBodies(o);
return;
} else if (name == "com.sun.star.beans.XFastPropertySet") {
- generated.add(name.toUtf8());
+ generated.add(u2b(name));
generateXFastPropertySetBodies(o);
return;
} else if (name == "com.sun.star.beans.XPropertyAccess") {
- generated.add(name.toUtf8());
+ generated.add(u2b(name));
generateXPropertyAccessBodies(o);
return;
}
@@ -425,7 +425,7 @@ void printMethods(std::ostream & o,
bool body = !delegate.isEmpty();
bool defaultbody = delegate == sd;
- generated.add(name.toUtf8());
+ generated.add(u2b(name));
rtl::Reference< unoidl::Entity > ent;
if (manager->getSort(name, &ent) != codemaker::UnoType::Sort::Interface)
{
@@ -570,7 +570,7 @@ static void printConstructors(
o << "create";
} else {
o << codemaker::java::translateUnoToJavaIdentifier(
- rConstructor.name.toUtf8(), "method");
+ u2b(rConstructor.name), "method");
}
o << "(com.sun.star.uno.XComponentContext the_context";
for (const auto& rParam : rConstructor.parameters)
@@ -582,7 +582,7 @@ static void printConstructors(
}
o << ' '
<< codemaker::java::translateUnoToJavaIdentifier(
- rParam.name.toUtf8(), "param");
+ u2b(rParam.name), "param");
}
o << ')';
printExceptionSpecification(o, options, manager, rConstructor.exceptions);
@@ -601,12 +601,12 @@ static void printServiceMembers(
for (const auto& rService : entity->getDirectMandatoryBaseServices())
{
o << "\n// exported service " << rService.name << "\n";
- generateDocumentation(o, options, manager, rService.name.toUtf8(), delegate);
+ generateDocumentation(o, options, manager, u2b(rService.name), delegate);
}
for (const auto& rIface : entity->getDirectMandatoryBaseInterfaces())
{
o << "\n// supported interface " << rIface.name << "\n";
- generateDocumentation(o, options, manager, rIface.name.toUtf8(), delegate);
+ generateDocumentation(o, options, manager, u2b(rIface.name), delegate);
}
o << "\n// properties of service \""<< name << "\"\n";
for (const auto& rProp : entity->getDirectProperties())
@@ -615,7 +615,7 @@ static void printServiceMembers(
printType(o, options, manager, rProp.type, false);
o << " "
<< codemaker::java::translateUnoToJavaIdentifier(
- rProp.name.toUtf8(), "property")
+ u2b(rProp.name), "property")
<< ";\n";
}
}
@@ -647,7 +647,7 @@ void generateDocumentation(std::ostream & o,
OUString nucleus;
sal_Int32 rank;
codemaker::UnoType::Sort sort = manager->decompose(
- OUString::fromUtf8(type), false, &nucleus, &rank, nullptr, nullptr);
+ b2u(type), false, &nucleus, &rank, nullptr, nullptr);
bool comment = true;
if (!delegate.isEmpty()) {
@@ -730,7 +730,7 @@ void generateDocumentation(std::ostream & o,
std::vector< OUString > arguments;
rtl::Reference< unoidl::Entity > entity;
sort = manager->decompose(
- OUString::fromUtf8(type), true, &nucleus, &rank, &arguments, &entity);
+ b2u(type), true, &nucleus, &rank, &arguments, &entity);
if (rank != 0) {
printMapsToJavaType(
o, options, manager, sort, nucleus, rank, arguments, "array");
@@ -816,8 +816,8 @@ void generateDocumentation(std::ostream & o,
printConstructors(o, options, manager, nucleus);
generateDocumentation(
o, options, manager,
- dynamic_cast< unoidl::SingleInterfaceBasedServiceEntity * >(
- entity.get())->getBase().toUtf8(),
+ u2b(dynamic_cast< unoidl::SingleInterfaceBasedServiceEntity * >(
+ entity.get())->getBase()),
delegate);
break;
diff --git a/unodevtools/source/skeletonmaker/skeletoncommon.cxx b/unodevtools/source/skeletonmaker/skeletoncommon.cxx
index 9fc47f175861..f57afcdab7ce 100644
--- a/unodevtools/source/skeletonmaker/skeletoncommon.cxx
+++ b/unodevtools/source/skeletonmaker/skeletoncommon.cxx
@@ -81,7 +81,7 @@ bool getOutputStream(ProgramOptions const & options,
if( !file.isValid() )
{
throw CannotDumpException(
- "cannot open " + OUString::fromUtf8(targetSourceFileName) + " for writing");
+ "cannot open " + b2u(targetSourceFileName) + " for writing");
}
tmpSourceFileName = file.getName();
file.close();
@@ -539,10 +539,10 @@ static void generateFunctionParameterMap(std::ostream& o,
o, options, manager, rBase.name, generated, bFirst);
}
- if ( generated.contains(name.toUtf8()) )
+ if ( generated.contains(u2b(name)) )
return;
else
- generated.add(name.toUtf8());
+ generated.add(u2b(name));
for (const auto& rMethod : ent2->getDirectMethods())
{