diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-21 13:42:35 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-21 15:55:46 +0100 |
commit | 25298930bc86d1a449a7e5b139d65e49f695f8c1 (patch) | |
tree | b3f28ef6b18b12347694a637b6785ecb5eedc1fe /codemaker | |
parent | 1edaee2f03bce0efa409c592919458658d0aa751 (diff) |
loplugin:flatten in canvas..cui
Change-Id: I208767eaa60d913fe2882403f1f9351eb08256f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127224
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'codemaker')
-rw-r--r-- | codemaker/source/cppumaker/cpputype.cxx | 121 |
1 files changed, 61 insertions, 60 deletions
diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index 221fee39acfc..dab77fa42292 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -2088,33 +2088,33 @@ void PlainStructType::dumpComprehensiveGetCppuType(FileStream & out) bool PlainStructType::dumpBaseMembers( FileStream & out, OUString const & base, bool withType) { - bool hasMember = false; - if (!base.isEmpty()) { - rtl::Reference< unoidl::Entity > ent; - codemaker::UnoType::Sort sort = m_typeMgr->getSort(base, &ent); - if (sort != codemaker::UnoType::Sort::PlainStruct) { - throw CannotDumpException( - "plain struct type base " + base - + " is not a plain struct type"); - } - rtl::Reference< unoidl::PlainStructTypeEntity > ent2( - dynamic_cast< unoidl::PlainStructTypeEntity * >(ent.get())); - assert(ent2.is()); - if (!ent2.is()) { - return false; + if (base.isEmpty()) + return false; + + rtl::Reference< unoidl::Entity > ent; + codemaker::UnoType::Sort sort = m_typeMgr->getSort(base, &ent); + if (sort != codemaker::UnoType::Sort::PlainStruct) { + throw CannotDumpException( + "plain struct type base " + base + + " is not a plain struct type"); + } + rtl::Reference< unoidl::PlainStructTypeEntity > ent2( + dynamic_cast< unoidl::PlainStructTypeEntity * >(ent.get())); + assert(ent2.is()); + if (!ent2.is()) { + return false; + } + bool hasMember = dumpBaseMembers(out, ent2->getDirectBase(), withType); + for (const unoidl::PlainStructTypeEntity::Member& member : ent2->getDirectMembers()) { + if (hasMember) { + out << ", "; } - hasMember = dumpBaseMembers(out, ent2->getDirectBase(), withType); - for (const unoidl::PlainStructTypeEntity::Member& member : ent2->getDirectMembers()) { - if (hasMember) { - out << ", "; - } - if (withType) { - dumpType(out, member.type, true, true); - out << " "; - } - out << member.name << "_"; - hasMember = true; + if (withType) { + dumpType(out, member.type, true, true); + out << " "; } + out << member.name << "_"; + hasMember = true; } return hasMember; } @@ -3198,45 +3198,46 @@ void ExceptionType::dumpDeclaration(FileStream & out) bool ExceptionType::dumpBaseMembers( FileStream & out, OUString const & base, bool withType, bool eligibleForDefaults) { + if (base.isEmpty()) + return false; + bool hasMember = false; - if (!base.isEmpty()) { - rtl::Reference< unoidl::Entity > ent; - codemaker::UnoType::Sort sort = m_typeMgr->getSort(base, &ent); - if (sort != codemaker::UnoType::Sort::Exception) { - throw CannotDumpException( - "exception type base " + base + " is not an exception type"); + rtl::Reference< unoidl::Entity > ent; + codemaker::UnoType::Sort sort = m_typeMgr->getSort(base, &ent); + if (sort != codemaker::UnoType::Sort::Exception) { + throw CannotDumpException( + "exception type base " + base + " is not an exception type"); + } + rtl::Reference< unoidl::ExceptionTypeEntity > ent2( + dynamic_cast< unoidl::ExceptionTypeEntity * >(ent.get())); + assert(ent2.is()); + if (!ent2.is()) { + return false; + } + hasMember = dumpBaseMembers( out, ent2->getDirectBase(), withType, + eligibleForDefaults && ent2->getDirectMembers().empty() ); + int memberCount = 0; + for (const unoidl::ExceptionTypeEntity::Member& member : ent2->getDirectMembers()) { + if (hasMember) { + out << ", "; } - rtl::Reference< unoidl::ExceptionTypeEntity > ent2( - dynamic_cast< unoidl::ExceptionTypeEntity * >(ent.get())); - assert(ent2.is()); - if (!ent2.is()) { - return false; + if (withType) { + dumpType(out, member.type, true, true); + out << " "; } - hasMember = dumpBaseMembers( out, ent2->getDirectBase(), withType, - eligibleForDefaults && ent2->getDirectMembers().empty() ); - int memberCount = 0; - for (const unoidl::ExceptionTypeEntity::Member& member : ent2->getDirectMembers()) { - if (hasMember) { - out << ", "; - } - if (withType) { - dumpType(out, member.type, true, true); - out << " "; - } - out << member.name << "_"; - // We want to provide a default parameter value for uno::Exception subtype - // constructors, since most of the time we don't pass a Context object in to the exception - // throw sites. - if (eligibleForDefaults - && base == "com.sun.star.uno.Exception" - && memberCount == 1 - && member.name == "Context" - && member.type == "com.sun.star.uno.XInterface") { - out << " = ::css::uno::Reference< ::css::uno::XInterface >()"; - } - hasMember = true; - ++memberCount; + out << member.name << "_"; + // We want to provide a default parameter value for uno::Exception subtype + // constructors, since most of the time we don't pass a Context object in to the exception + // throw sites. + if (eligibleForDefaults + && base == "com.sun.star.uno.Exception" + && memberCount == 1 + && member.name == "Context" + && member.type == "com.sun.star.uno.XInterface") { + out << " = ::css::uno::Reference< ::css::uno::XInterface >()"; } + hasMember = true; + ++memberCount; } return hasMember; } |