summaryrefslogtreecommitdiff
path: root/codemaker
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 /codemaker
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 'codemaker')
-rw-r--r--codemaker/source/codemaker/exceptiontree.cxx6
-rw-r--r--codemaker/source/codemaker/typemanager.cxx4
-rw-r--r--codemaker/source/commoncpp/commoncpp.cxx3
-rw-r--r--codemaker/source/cppumaker/cppumaker.cxx2
-rw-r--r--codemaker/source/cppumaker/cpputype.cxx128
-rw-r--r--codemaker/source/cppumaker/dependencies.cxx4
-rw-r--r--codemaker/source/cppumaker/includes.cxx14
-rw-r--r--codemaker/source/javamaker/javamaker.cxx2
-rw-r--r--codemaker/source/javamaker/javatype.cxx10
9 files changed, 88 insertions, 85 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;
}