diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-04-05 11:41:39 +0100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-04-05 16:13:14 +0200 |
commit | dacde2c0394d33a04bc9ad929df394465c14b093 (patch) | |
tree | 6669725646ddcf2bbf467b9dfb8c9739fe05139f | |
parent | d33b3efa90bed4f317c872b1c2b83696cdedaa26 (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>
-rw-r--r-- | codemaker/source/codemaker/exceptiontree.cxx | 6 | ||||
-rw-r--r-- | codemaker/source/codemaker/typemanager.cxx | 4 | ||||
-rw-r--r-- | codemaker/source/commoncpp/commoncpp.cxx | 3 | ||||
-rw-r--r-- | codemaker/source/cppumaker/cppumaker.cxx | 2 | ||||
-rw-r--r-- | codemaker/source/cppumaker/cpputype.cxx | 128 | ||||
-rw-r--r-- | codemaker/source/cppumaker/dependencies.cxx | 4 | ||||
-rw-r--r-- | codemaker/source/cppumaker/includes.cxx | 14 | ||||
-rw-r--r-- | codemaker/source/javamaker/javamaker.cxx | 2 | ||||
-rw-r--r-- | codemaker/source/javamaker/javatype.cxx | 10 | ||||
-rw-r--r-- | include/codemaker/typemanager.hxx | 9 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/cppcompskeleton.cxx | 18 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/cpptypemaker.cxx | 59 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/javacompskeleton.cxx | 18 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/javatypemaker.cxx | 40 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/skeletoncommon.cxx | 6 |
15 files changed, 167 insertions, 156 deletions
diff --git a/codemaker/source/codemaker/exceptiontree.cxx b/codemaker/source/codemaker/exceptiontree.cxx index 796f52671ce3..b6c2aeee6f87 100644 --- a/codemaker/source/codemaker/exceptiontree.cxx +++ b/codemaker/source/codemaker/exceptiontree.cxx @@ -55,10 +55,12 @@ void ExceptionTree::add( } list.push_back(n); rtl::Reference< unoidl::Entity > ent; - codemaker::UnoType::Sort s = manager->getSort(OUString::fromUtf8(n), &ent); + codemaker::UnoType::Sort s = manager->getSort(b2u(n), &ent); (void) s; // WaE: unused variable assert(s == codemaker::UnoType::Sort::Exception); - n = static_cast<unoidl::ExceptionTypeEntity*>(ent.get())->getDirectBase().toUtf8(); + n = u2b( + static_cast< unoidl::ExceptionTypeEntity * >(ent.get())-> + getDirectBase()); assert(!n.isEmpty()); } if (!bRuntimeException) { diff --git a/codemaker/source/codemaker/typemanager.cxx b/codemaker/source/codemaker/typemanager.cxx index f723ee699948..cf638f0ca4eb 100644 --- a/codemaker/source/codemaker/typemanager.cxx +++ b/codemaker/source/codemaker/typemanager.cxx @@ -164,7 +164,7 @@ codemaker::UnoType::Sort TypeManager::decompose( { sal_Int32 k; std::vector< OString > args; - OUString n = OUString::fromUtf8(codemaker::UnoType::decompose(name.toUtf8(), &k, &args)); + OUString n = b2u(codemaker::UnoType::decompose(u2b(name), &k, &args)); for (;;) { rtl::Reference< unoidl::Entity > ent; codemaker::UnoType::Sort s = getSort(n, &ent); @@ -238,7 +238,7 @@ codemaker::UnoType::Sort TypeManager::decompose( arguments->clear(); for (const OString& rArg : args) { - arguments->push_back(OUString::fromUtf8(rArg)); + arguments->push_back(b2u(rArg)); } } if (entity != nullptr) { diff --git a/codemaker/source/commoncpp/commoncpp.cxx b/codemaker/source/commoncpp/commoncpp.cxx index 07b689a39b06..6774aedf4fba 100644 --- a/codemaker/source/commoncpp/commoncpp.cxx +++ b/codemaker/source/commoncpp/commoncpp.cxx @@ -79,7 +79,8 @@ OString translateUnoToCppType( { buf.append("::css::uno::XInterface"); } else { - buf.append(nucleus.toUtf8()); // nucleus must be a valid UTF-16 + //TODO: check that nucleus is a valid (UTF-8) identifier + buf.append(u2b(nucleus)); } } return buf.makeStringAndClear(); diff --git a/codemaker/source/cppumaker/cppumaker.cxx b/codemaker/source/cppumaker/cppumaker.cxx index 9adf31d07d36..b1769eda87a6 100644 --- a/codemaker/source/cppumaker/cppumaker.cxx +++ b/codemaker/source/cppumaker/cppumaker.cxx @@ -54,7 +54,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { } codemaker::GeneratedTypeSet generated; if (options.isValid("-T")) { - OUString names(OUString::fromUtf8(options.getOption("-T"))); + OUString names(b2u(options.getOption("-T"))); for (sal_Int32 i = 0; i != -1;) { OUString name(names.getToken(0, ';', i)); if (!name.isEmpty()) { diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index a32e8dd1d0ca..368cfb6e72f1 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -408,7 +408,7 @@ void CppuType::dump(CppuOptions const & options) m_cppuTypeDynamic = false; } dumpFiles( - options.isValid("-O") ? OUString::fromUtf8(options.getOption("-O")) : "", options); + options.isValid("-O") ? b2u(options.getOption("-O")) : "", options); } void CppuType::dumpFile( @@ -416,18 +416,18 @@ void CppuType::dumpFile( CppuOptions const & options) { OUString fileUri( - OUString::fromUtf8(createFileNameFromType( - uri.toUtf8(), name.toUtf8(), hpp ? ".hpp" : ".hdl"))); + b2u(createFileNameFromType( + u2b(uri), u2b(name), hpp ? ".hpp" : ".hdl"))); if (fileUri.isEmpty()) { throw CannotDumpException("empty target URI for entity " + name); } - bool exists = fileExists(fileUri.toUtf8()); + bool exists = fileExists(u2b(fileUri)); if (exists && options.isValid("-G")) { return; } FileStream out; - out.createTempFile(getTempDir(fileUri.toUtf8())); - OUString tmpUri(OUString::fromUtf8(out.getName())); + out.createTempFile(getTempDir(u2b(fileUri))); + OUString tmpUri(b2u(out.getName())); if(!out.isValid()) { throw CannotDumpException("cannot open " + tmpUri + " for writing"); } @@ -443,15 +443,15 @@ void CppuType::dumpFile( out.close(); // Remove existing type file if something goes wrong to ensure // consistency: - if (fileExists(fileUri.toUtf8())) { - removeTypeFile(fileUri.toUtf8()); + if (fileExists(u2b(fileUri))) { + removeTypeFile(u2b(fileUri)); } - removeTypeFile(tmpUri.toUtf8()); + removeTypeFile(u2b(tmpUri)); throw; } out.close(); (void)makeValidTypeFile( - fileUri.toUtf8(), tmpUri.toUtf8(), exists && options.isValid("-Gc")); + u2b(fileUri), u2b(tmpUri), exists && options.isValid("-Gc")); } void CppuType::dumpDependedTypes( @@ -506,8 +506,8 @@ void CppuType::dumpInitializer( sal_Int32 k; std::vector< OString > args; OUString n( - OUString::fromUtf8(codemaker::UnoType::decompose( - resolveAllTypedefs(name).toUtf8(), &k, &args))); + b2u(codemaker::UnoType::decompose( + u2b(resolveAllTypedefs(name)), &k, &args))); if (k == 0) { rtl::Reference< unoidl::Entity > ent; switch (m_typeMgr->getSort(n, &ent)) { @@ -527,7 +527,7 @@ void CppuType::dumpInitializer( out << "0"; break; case codemaker::UnoType::Sort::Enum: - out << codemaker::cpp::scopedCppName(n.toUtf8()) << "_" + out << codemaker::cpp::scopedCppName(u2b(n)) << "_" << (dynamic_cast<unoidl::EnumTypeEntity&>(*ent.get()). getMembers()[0].name); break; @@ -751,8 +751,8 @@ void CppuType::dumpType( sal_Int32 k; std::vector< OString > args; OUString n( - OUString::fromUtf8(codemaker::UnoType::decompose( - resolveAllTypedefs(name).toUtf8(), &k, &args))); + b2u(codemaker::UnoType::decompose( + u2b(resolveAllTypedefs(name)), &k, &args))); if (isConst) { out << "const "; } @@ -810,10 +810,10 @@ void CppuType::dumpType( case codemaker::UnoType::Sort::Enum: case codemaker::UnoType::Sort::PlainStruct: case codemaker::UnoType::Sort::Exception: - out << codemaker::cpp::scopedCppName(n.toUtf8()); + out << codemaker::cpp::scopedCppName(u2b(n)); break; case codemaker::UnoType::Sort::PolymorphicStructTemplate: - out << codemaker::cpp::scopedCppName(n.toUtf8()); + out << codemaker::cpp::scopedCppName(u2b(n)); if (!args.empty()) { out << "< "; for (std::vector< OString >::iterator i(args.begin()); @@ -821,7 +821,7 @@ void CppuType::dumpType( if (i != args.begin()) { out << ", "; } - dumpType(out, OUString::fromUtf8(*i)); + dumpType(out, b2u(*i)); } out << " >"; } @@ -830,7 +830,7 @@ void CppuType::dumpType( if (!native) { out << "::css::uno::Reference< "; } - out << codemaker::cpp::scopedCppName(n.toUtf8()); + out << codemaker::cpp::scopedCppName(u2b(n)); if (!native) { out << " >"; } @@ -993,15 +993,15 @@ OUString CppuType::resolveOuterTypedefs(OUString const & name) const OUString CppuType::resolveAllTypedefs(OUString const & name) const { sal_Int32 k1; - OUString n(OUString::fromUtf8(codemaker::UnoType::decompose(name.toUtf8(), &k1))); + OUString n(b2u(codemaker::UnoType::decompose(u2b(name), &k1))); for (;;) { rtl::Reference< unoidl::Entity > ent; if (m_typeMgr->getSort(n, &ent) != codemaker::UnoType::Sort::Typedef) { break; } sal_Int32 k2; - n = OUString::fromUtf8(codemaker::UnoType::decompose( - dynamic_cast<unoidl::TypedefEntity&>(*ent).getType().toUtf8(), &k2)); + n = b2u(codemaker::UnoType::decompose( + u2b(dynamic_cast<unoidl::TypedefEntity&>(*ent).getType()), &k2)); k1 += k2; //TODO: overflow } OUStringBuffer b; @@ -1153,7 +1153,7 @@ void InterfaceType::dumpDeclaration(FileStream & out) entity_->getDirectMandatoryBases().begin()); i != entity_->getDirectMandatoryBases().end(); ++i) { out << (i == entity_->getDirectMandatoryBases().begin() ? " :" : ",") - << " public " << codemaker::cpp::scopedCppName(i->name.toUtf8()); + << " public " << codemaker::cpp::scopedCppName(u2b(i->name)); } out << "\n{\npublic:\n"; inc(); @@ -1188,7 +1188,7 @@ void InterfaceType::dumpHppFile( out << "\n"; dumpGetCppuType(out); out << "\n::css::uno::Type const & " - << codemaker::cpp::scopedCppName(name_.toUtf8()) + << codemaker::cpp::scopedCppName(u2b(name_)) << "::static_type(SAL_UNUSED_PARAMETER void *) {\n"; inc(); out << indent() << "return ::cppu::UnoType< "; @@ -1670,7 +1670,7 @@ void ConstantGroup::dumpHppFile( { OUString headerDefine(dumpHeaderDefine(out, "HPP")); out << "\n"; - codemaker::cppumaker::Includes::dumpInclude(out, name_.toUtf8(), false); + codemaker::cppumaker::Includes::dumpInclude(out, u2b(name_), false); out << "\n#endif // "<< headerDefine << "\n"; } @@ -1822,7 +1822,7 @@ void PlainStructType::dumpDeclaration(FileStream & out) out << id_; OUString base(entity_->getDirectBase()); if (!base.isEmpty()) { - out << ": public " << codemaker::cpp::scopedCppName(base.toUtf8()); + out << ": public " << codemaker::cpp::scopedCppName(u2b(base)); } out << " {\n"; inc(); @@ -1852,7 +1852,7 @@ void PlainStructType::dumpDeclaration(FileStream & out) && i->type != "hyper" && i->type != "unsigned hyper" && i->type != "double") { out << " CPPU_GCC3_ALIGN(" - << codemaker::cpp::scopedCppName(base.toUtf8()) << ")"; + << codemaker::cpp::scopedCppName(u2b(base)) << ")"; } out << ";\n"; } @@ -1876,7 +1876,7 @@ void PlainStructType::dumpHppFile( OUString base(entity_->getDirectBase()); bool bFirst = true; if (!base.isEmpty()) { - out << indent() << ": " << codemaker::cpp::scopedCppName(base.toUtf8()) + out << indent() << ": " << codemaker::cpp::scopedCppName(u2b(base)) << "()\n"; bFirst = false; } @@ -1904,7 +1904,7 @@ void PlainStructType::dumpHppFile( inc(); bFirst = true; if (!base.isEmpty()) { - out << indent() << ": " << codemaker::cpp::scopedCppName(base.toUtf8()) + out << indent() << ": " << codemaker::cpp::scopedCppName(u2b(base)) << "("; dumpBaseMembers(out, base, false); out << ")\n"; @@ -1925,8 +1925,8 @@ void PlainStructType::dumpHppFile( out << indent() << "return "; bFirst = true; if (!base.isEmpty()) { - out << "operator==( static_cast< " << codemaker::cpp::scopedCppName(base.toUtf8()) - << ">(the_lhs), static_cast< " << codemaker::cpp::scopedCppName(base.toUtf8()) << ">(the_rhs) )\n"; + out << "operator==( static_cast< " << codemaker::cpp::scopedCppName(u2b(base)) + << ">(the_lhs), static_cast< " << codemaker::cpp::scopedCppName(u2b(base)) << ">(the_rhs) )\n"; bFirst = false; } for (const unoidl::PlainStructTypeEntity::Member& member : entity_->getDirectMembers()) { @@ -2674,7 +2674,7 @@ void PolyStructType::dumpTemplateParameters(FileStream & out) const OUString typeToIdentifier(OUString const & name) { sal_Int32 k; - OUString n(OUString::fromUtf8(codemaker::UnoType::decompose(name.toUtf8(), &k))); + OUString n(b2u(codemaker::UnoType::decompose(u2b(name), &k))); OUStringBuffer b; for (sal_Int32 i = 0; i != k; ++i) { b.append("seq_"); @@ -2760,7 +2760,7 @@ void ExceptionType::dumpHppFile( OUString base(entity_->getDirectBase()); bool bFirst = true; if (!base.isEmpty()) { - out << indent() << ": " << codemaker::cpp::scopedCppName(base.toUtf8()) + out << indent() << ": " << codemaker::cpp::scopedCppName(u2b(base)) << "()\n"; bFirst = false; } @@ -2797,7 +2797,7 @@ void ExceptionType::dumpHppFile( inc(); bFirst = true; if (!base.isEmpty()) { - out << indent() << ": " << codemaker::cpp::scopedCppName(base.toUtf8()) + out << indent() << ": " << codemaker::cpp::scopedCppName(u2b(base)) << "("; dumpBaseMembers(out, base, false, false); out << ")\n"; @@ -2824,7 +2824,7 @@ void ExceptionType::dumpHppFile( << "(" << id_ << " const & the_other)"; bFirst = true; if (!base.isEmpty()) { - out << ": " << codemaker::cpp::scopedCppName(base.toUtf8()) + out << ": " << codemaker::cpp::scopedCppName(u2b(base)) << "(the_other)"; bFirst = false; } @@ -2841,7 +2841,7 @@ void ExceptionType::dumpHppFile( << ("//TODO: Just like its implicitly-defined counterpart, this" " function definition is not exception-safe\n"); if (!base.isEmpty()) { - out << indent() << codemaker::cpp::scopedCppName(base.toUtf8()) + out << indent() << codemaker::cpp::scopedCppName(u2b(base)) << "::operator =(the_other);\n"; } for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers()) { @@ -3033,7 +3033,7 @@ void ExceptionType::dumpDeclaration(FileStream & out) out << "\nclass CPPU_GCC_DLLPUBLIC_EXPORT SAL_WARN_UNUSED " << id_; OUString base(entity_->getDirectBase()); if (!base.isEmpty()) { - out << " : public " << codemaker::cpp::scopedCppName(base.toUtf8()); + out << " : public " << codemaker::cpp::scopedCppName(u2b(base)); } out << "\n{\npublic:\n"; inc(); @@ -3068,7 +3068,7 @@ void ExceptionType::dumpDeclaration(FileStream & out) && i->type != "hyper" && i->type != "unsigned hyper" && i->type != "double") { out << " CPPU_GCC3_ALIGN( " - << codemaker::cpp::scopedCppName(base.toUtf8()) << " )"; + << codemaker::cpp::scopedCppName(u2b(base)) << " )"; } out << ";\n"; } @@ -3179,7 +3179,7 @@ void EnumType::dumpDeclaration(FileStream& o) inc(); for (const unoidl::EnumTypeEntity::Member& member : entity_->getMembers()) { - o << indent() << id_ << "_" << member.name.toUtf8() << " = " << member.value + o << indent() << id_ << "_" << u2b(member.name) << " = " << member.value << ",\n"; } @@ -3191,9 +3191,9 @@ void EnumType::dumpDeclaration(FileStream& o) // use constexpr to create a kind of type-alias so we don't have to modify existing code o << "#if defined LIBO_INTERNAL_ONLY\n"; for (const unoidl::EnumTypeEntity::Member& member : entity_->getMembers()) { - o << "constexpr auto " << id_ << "_" << member.name.toUtf8() + o << "constexpr auto " << id_ << "_" << u2b(member.name) << " = " - << id_ << "::" << id_ << "_" << member.name.toUtf8() + << id_ << "::" << id_ << "_" << u2b(member.name) << ";\n"; } o << "#endif\n"; @@ -3227,8 +3227,8 @@ void EnumType::dumpNormalGetCppuType(FileStream& o) o << indent() << "typelib_static_enum_type_init( &the_type,\n"; inc(31); o << indent() << "\"" << name_ << "\",\n" - << indent() << codemaker::cpp::scopedCppName(name_.toUtf8()) << "_" - << entity_->getMembers()[0].name.toUtf8() << " );\n"; + << indent() << codemaker::cpp::scopedCppName(u2b(name_)) << "_" + << u2b(entity_->getMembers()[0].name) << " );\n"; dec(31); dec(); o << indent() << "}\n"; @@ -3265,7 +3265,7 @@ void EnumType::dumpComprehensiveGetCppuType(FileStream& o) std::vector< unoidl::EnumTypeEntity::Member >::size_type n = 0; for (const unoidl::EnumTypeEntity::Member& member : entity_->getMembers()) { o << indent() << "::rtl::OUString sEnumValue" << n << "( \"" - << member.name.toUtf8() << "\" );\n"; + << u2b(member.name) << "\" );\n"; o << indent() << "enumValueNames[" << n << "] = sEnumValue" << n << ".pData;\n"; ++n; @@ -3282,8 +3282,8 @@ void EnumType::dumpComprehensiveGetCppuType(FileStream& o) inc(); o << indent() << "sTypeName.pData,\n" << indent() << "(sal_Int32)" - << codemaker::cpp::scopedCppName(name_.toUtf8(), false) << "_" - << entity_->getMembers()[0].name.toUtf8() << ",\n" + << codemaker::cpp::scopedCppName(u2b(name_), false) << "_" + << u2b(entity_->getMembers()[0].name) << ",\n" << indent() << entity_->getMembers().size() << ", enumValueNames, enumValues );\n\n"; dec(); @@ -3465,8 +3465,8 @@ void ServiceType::dumpHppFile( for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor::Parameter& param : cons.parameters) { if (m_typeMgr->getSort( - OUString::fromUtf8(codemaker::UnoType::decompose( - param.type.toUtf8()))) + b2u(codemaker::UnoType::decompose( + u2b(param.type)))) == codemaker::UnoType::Sort::Char) { includes.addCppuUnotypeHxx(); break; @@ -3475,7 +3475,7 @@ void ServiceType::dumpHppFile( } codemaker::ExceptionTree tree; for (const OUString& ex : cons.exceptions) { - tree.add(ex.toUtf8(), m_typeMgr); + tree.add(u2b(ex), m_typeMgr); } if (!tree.getRoot().present) { includes.add("com.sun.star.uno.Exception"); @@ -3487,7 +3487,7 @@ void ServiceType::dumpHppFile( } OString cppName( codemaker::cpp::translateUnoToCppIdentifier( - id_.toUtf8(), "service", isGlobal())); + u2b(id_), "service", isGlobal())); OUString headerDefine(dumpHeaderDefine(o, "HPP")); o << "\n"; includes.dump(o, nullptr, true); @@ -3512,7 +3512,7 @@ void ServiceType::dumpHppFile( o << "\nclass " << cppName << " {\n"; inc(); if (!entity_->getConstructors().empty()) { - OString baseName(entity_->getBase().toUtf8()); + OString baseName(u2b(entity_->getBase())); OString scopedBaseName(codemaker::cpp::scopedCppName(baseName)); o << "public:\n"; for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor& cons : @@ -3579,7 +3579,7 @@ void ServiceType::dumpHppFile( o << indent() << "static ::css::uno::Reference< " << scopedBaseName << " > " << codemaker::cpp::translateUnoToCppIdentifier( - cons.name.toUtf8(), "method", codemaker::cpp::IdentifierTranslationMode::NonGlobal, + u2b(cons.name), "method", codemaker::cpp::IdentifierTranslationMode::NonGlobal, &cppName) << ("(::css::uno::Reference< ::css::uno::XComponentContext > const &" " the_context"); @@ -3597,7 +3597,7 @@ void ServiceType::dumpHppFile( dumpType(o, type, byRef, byRef); o << " " << codemaker::cpp::translateUnoToCppIdentifier( - param.name.toUtf8(), "param", codemaker::cpp::IdentifierTranslationMode::NonGlobal); + u2b(param.name), "param", codemaker::cpp::IdentifierTranslationMode::NonGlobal); } o << ") {\n"; inc(); @@ -3614,14 +3614,14 @@ void ServiceType::dumpHppFile( o << indent() << "the_arguments[" << n++ << "] "; OString param( codemaker::cpp::translateUnoToCppIdentifier( - j.name.toUtf8(), "param", + u2b(j.name), "param", codemaker::cpp::IdentifierTranslationMode::NonGlobal)); sal_Int32 rank; if (resolveOuterTypedefs(j.type) == "any") { o << "= " << param; } else if (m_typeMgr->getSort( - OUString::fromUtf8(codemaker::UnoType::decompose( - j.type.toUtf8(), &rank))) + b2u(codemaker::UnoType::decompose( + u2b(j.type), &rank))) == codemaker::UnoType::Sort::Char) { o << "= ::css::uno::Any(&" << param << ", ::cppu::UnoType< "; @@ -3643,7 +3643,7 @@ void ServiceType::dumpHppFile( << scopedBaseName << " > the_instance;\n"; codemaker::ExceptionTree tree; for (const OUString& ex : cons.exceptions) { - tree.add(ex.toUtf8(), m_typeMgr); + tree.add(u2b(ex), m_typeMgr); } if (!tree.getRoot().present) { o << indent() << "try {\n"; @@ -3664,7 +3664,7 @@ void ServiceType::dumpHppFile( << ")(the_context.get(), "; if (rest) { o << codemaker::cpp::translateUnoToCppIdentifier( - cons.parameters.back().name.toUtf8(), "param", + u2b(cons.parameters.back().name), "param", codemaker::cpp::IdentifierTranslationMode::NonGlobal); } else if (cons.parameters.empty()) { o << "::css::uno::Sequence< ::css::uno::Any >()"; @@ -3691,7 +3691,7 @@ void ServiceType::dumpHppFile( << name_ << "\", "; if (rest) { o << codemaker::cpp::translateUnoToCppIdentifier( - cons.parameters.back().name.toUtf8(), "param", + u2b(cons.parameters.back().name), "param", codemaker::cpp::IdentifierTranslationMode::NonGlobal); } else if (cons.parameters.empty()) { o << "::css::uno::Sequence< ::css::uno::Any >()"; @@ -3747,7 +3747,7 @@ void ServiceType::dumpCatchClauses( { if (node->present) { out << indent() << "} catch (const "; - dumpType(out, OUString::fromUtf8(node->name)); + dumpType(out, b2u(node->name)); out << " &) {\n"; inc(); out << indent() << "throw;\n"; @@ -3781,8 +3781,8 @@ void SingletonType::dumpHppFile( { OString cppName( codemaker::cpp::translateUnoToCppIdentifier( - id_.toUtf8(), "singleton", isGlobal())); - OString baseName(entity_->getBase().toUtf8()); + u2b(id_), "singleton", isGlobal())); + OString baseName(u2b(entity_->getBase())); OString scopedBaseName(codemaker::cpp::scopedCppName(baseName)); OUString headerDefine(dumpHeaderDefine(o, "HPP")); o << "\n"; @@ -3872,10 +3872,10 @@ void produce( OUString const & name, rtl::Reference< TypeManager > const & manager, codemaker::GeneratedTypeSet & generated, CppuOptions const & options) { - if (generated.contains(name.toUtf8())) { + if (generated.contains(u2b(name))) { return; } - generated.add(name.toUtf8()); + generated.add(u2b(name)); if (!manager->foundAtPrimaryProvider(name)) { return; } diff --git a/codemaker/source/cppumaker/dependencies.cxx b/codemaker/source/cppumaker/dependencies.cxx index 8452acca6001..71855e2a9e47 100644 --- a/codemaker/source/cppumaker/dependencies.cxx +++ b/codemaker/source/cppumaker/dependencies.cxx @@ -215,7 +215,7 @@ Dependencies::~Dependencies() {} void Dependencies::insert(OUString const & name, Kind kind) { sal_Int32 k; std::vector< OString > args; - OUString n(OUString::fromUtf8(UnoType::decompose(name.toUtf8(), &k, &args))); + OUString n(b2u(UnoType::decompose(u2b(name), &k, &args))); if (k != 0) { m_sequenceDependency = true; } @@ -266,7 +266,7 @@ void Dependencies::insert(OUString const & name, Kind kind) { case UnoType::Sort::PolymorphicStructTemplate: for (const OString& arg : args) { - insert(OUString::fromUtf8(arg), KIND_NORMAL); + insert(b2u(arg), KIND_NORMAL); } [[fallthrough]]; case UnoType::Sort::Sequence: diff --git a/codemaker/source/cppumaker/includes.cxx b/codemaker/source/cppumaker/includes.cxx index a41b29dc91e7..732f5065c191 100644 --- a/codemaker/source/cppumaker/includes.cxx +++ b/codemaker/source/cppumaker/includes.cxx @@ -71,7 +71,7 @@ Includes::~Includes() void Includes::add(OString const & entityName) { sal_Int32 k; std::vector< OString > args; - OUString n(OUString::fromUtf8(codemaker::UnoType::decompose(entityName, &k, &args))); + OUString n(b2u(codemaker::UnoType::decompose(entityName, &k, &args))); if (k != 0) { m_includeSequence = true; } @@ -115,7 +115,7 @@ void Includes::add(OString const & entityName) { break; default: throw CannotDumpException( - "unexpected type \"" + OUString::fromUtf8(entityName) + "unexpected type \"" + b2u(entityName) + "\" in call to codemaker::cppumaker::Includes::add"); } } @@ -139,7 +139,7 @@ void Includes::dump( if (!m_includeReference) { for (const auto& pair : m_map) { - if (isInterfaceType(pair.first.toUtf8())) { + if (isInterfaceType(u2b(pair.first))) { m_includeReference = true; break; } @@ -151,7 +151,7 @@ void Includes::dump( } if (companionHdl) { out << "\n"; - dumpInclude(out, companionHdl->toUtf8(), false); + dumpInclude(out, u2b(*companionHdl), false); } bool first = true; for (const auto& pair : m_map) @@ -159,11 +159,11 @@ void Includes::dump( if (exceptions || pair.second != Dependencies::KIND_EXCEPTION) { dumpEmptyLineBeforeFirst(out, &first); if (m_hpp || pair.second == Dependencies::KIND_BASE - || !isInterfaceType(pair.first.toUtf8())) + || !isInterfaceType(u2b(pair.first))) { // If we know our name, then avoid including ourselves. if (!companionHdl || *companionHdl != pair.first) { - dumpInclude(out, pair.first.toUtf8(), m_hpp); + dumpInclude(out, u2b(pair.first), m_hpp); } } else { bool ns = dumpNamespaceOpen(out, pair.first, false); @@ -264,7 +264,7 @@ void Includes::dumpInclude( } bool Includes::isInterfaceType(OString const & entityName) const { - return m_manager->getSort(OUString::fromUtf8(entityName)) == UnoType::Sort::Interface; + return m_manager->getSort(b2u(entityName)) == UnoType::Sort::Interface; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/codemaker/source/javamaker/javamaker.cxx b/codemaker/source/javamaker/javamaker.cxx index 09688ba2837d..3a35be56a39b 100644 --- a/codemaker/source/javamaker/javamaker.cxx +++ b/codemaker/source/javamaker/javamaker.cxx @@ -54,7 +54,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { } codemaker::GeneratedTypeSet generated; if (options.isValid("-T")) { - OUString names(OUString::fromUtf8(options.getOption("-T"))); + OUString names(b2u(options.getOption("-T"))); for (sal_Int32 i = 0; i != -1;) { OUString name(names.getToken(0, ';', i)); if (!name.isEmpty()) { diff --git a/codemaker/source/javamaker/javatype.cxx b/codemaker/source/javamaker/javatype.cxx index da7360f4273d..3130389e916b 100644 --- a/codemaker/source/javamaker/javatype.cxx +++ b/codemaker/source/javamaker/javatype.cxx @@ -613,7 +613,7 @@ void writeClassFile( tempfile.createTempFile(getTempDir(filename)); if (!tempfile.isValid()) { throw CannotDumpException( - "Cannot create temporary file for " + OUString::fromUtf8(filename)); + "Cannot create temporary file for " + b2u(filename)); } OString tempname(tempfile.getName()); try { @@ -630,8 +630,8 @@ void writeClassFile( tempfile.close(); if (!makeValidTypeFile(filename, tempname, bCheck)) { throw CannotDumpException( - "Cannot create " + OUString::fromUtf8(filename) + " from temporary file " - + OUString::fromUtf8(tempname)); + "Cannot create " + b2u(filename) + " from temporary file " + + b2u(tempname)); } } @@ -2442,10 +2442,10 @@ void produce( OUString const & name, rtl::Reference< TypeManager > const & manager, codemaker::GeneratedTypeSet & generated, JavaOptions const & options) { - if (generated.contains(name.toUtf8())) { + if (generated.contains(u2b(name))) { return; } - generated.add(name.toUtf8()); + generated.add(u2b(name)); if (!manager->foundAtPrimaryProvider(name)) { return; } diff --git a/include/codemaker/typemanager.hxx b/include/codemaker/typemanager.hxx index fcef7b59ac3e..3227393edb6e 100644 --- a/include/codemaker/typemanager.hxx +++ b/include/codemaker/typemanager.hxx @@ -62,6 +62,15 @@ private: std::vector< rtl::Reference< unoidl::Provider > > primaryProviders_; }; + +inline OString u2b(OUString const & s) { + return OUStringToOString(s, RTL_TEXTENCODING_UTF8); +} + +inline OUString b2u(OString const & s) { + return OStringToOUString(s, RTL_TEXTENCODING_UTF8); +} + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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()) { |