Kaydet (Commit) 7d4924a4 authored tarafından Noel Grandin's avatar Noel Grandin

improve parameter flow in cpputype.cxx

after commit
  c5d47c32
  "add default value for Context param in uno::Exception constructors"

Change-Id: Ib429b58c559ecd48764a8df2f49d5470057c2c63
üst 6ba6f1fa
...@@ -2682,7 +2682,7 @@ private: ...@@ -2682,7 +2682,7 @@ private:
bool dumpBaseMembers( bool dumpBaseMembers(
FileStream & out, OUString const & base, bool withType, FileStream & out, OUString const & base, bool withType,
bool withDefaults, bool parentsHadDirectMember); bool eligibleForDefaults);
sal_uInt32 getTotalMemberCount(OUString const & base) const; sal_uInt32 getTotalMemberCount(OUString const & base) const;
...@@ -2732,7 +2732,7 @@ void ExceptionType::dumpHxxFile( ...@@ -2732,7 +2732,7 @@ void ExceptionType::dumpHxxFile(
out << "}\n\n"; out << "}\n\n";
if (!entity_->getDirectMembers().empty() || getInheritedMemberCount() > 0) { if (!entity_->getDirectMembers().empty() || getInheritedMemberCount() > 0) {
out << indent() << "inline " << id_ << "::" << id_ << "("; out << indent() << "inline " << id_ << "::" << id_ << "(";
first = !dumpBaseMembers(out, base, true, false, false); first = !dumpBaseMembers(out, base, true, false);
for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator
i(entity_->getDirectMembers().begin()); i(entity_->getDirectMembers().begin());
i != entity_->getDirectMembers().end(); ++i) i != entity_->getDirectMembers().end(); ++i)
...@@ -2750,7 +2750,7 @@ void ExceptionType::dumpHxxFile( ...@@ -2750,7 +2750,7 @@ void ExceptionType::dumpHxxFile(
if (!base.isEmpty()) { if (!base.isEmpty()) {
out << indent() << ": " << codemaker::cpp::scopedCppName(u2b(base)) out << indent() << ": " << codemaker::cpp::scopedCppName(u2b(base))
<< "("; << "(";
dumpBaseMembers(out, base, false, false, false); dumpBaseMembers(out, base, false, false);
out << ")\n"; out << ")\n";
first = false; first = false;
} }
...@@ -2986,9 +2986,8 @@ void ExceptionType::dumpDeclaration(FileStream & out) { ...@@ -2986,9 +2986,8 @@ void ExceptionType::dumpDeclaration(FileStream & out) {
<< "() SAL_THROW(());\n\n"; << "() SAL_THROW(());\n\n";
if (!entity_->getDirectMembers().empty() || getInheritedMemberCount() > 0) { if (!entity_->getDirectMembers().empty() || getInheritedMemberCount() > 0) {
out << indent() << "inline CPPU_GCC_DLLPRIVATE " << id_ << "("; out << indent() << "inline CPPU_GCC_DLLPRIVATE " << id_ << "(";
bool withDefaults = true; bool eligibleForDefaults = entity_->getDirectMembers().empty();
bool parentsHadDirectMembers = !entity_->getDirectMembers().empty(); bool first = !dumpBaseMembers(out, base, true, eligibleForDefaults);
bool first = !dumpBaseMembers(out, base, true, withDefaults, parentsHadDirectMembers);
for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator
i(entity_->getDirectMembers().begin()); i(entity_->getDirectMembers().begin());
i != entity_->getDirectMembers().end(); ++i) i != entity_->getDirectMembers().end(); ++i)
...@@ -3027,7 +3026,7 @@ void ExceptionType::dumpDeclaration(FileStream & out) { ...@@ -3027,7 +3026,7 @@ void ExceptionType::dumpDeclaration(FileStream & out) {
} }
bool ExceptionType::dumpBaseMembers( bool ExceptionType::dumpBaseMembers(
FileStream & out, OUString const & base, bool withType, bool withDefaults, bool parentsHadDirectMember) FileStream & out, OUString const & base, bool withType, bool eligibleForDefaults)
{ {
bool hasMember = false; bool hasMember = false;
if (!base.isEmpty()) { if (!base.isEmpty()) {
...@@ -3041,7 +3040,7 @@ bool ExceptionType::dumpBaseMembers( ...@@ -3041,7 +3040,7 @@ bool ExceptionType::dumpBaseMembers(
dynamic_cast< unoidl::ExceptionTypeEntity * >(ent.get())); dynamic_cast< unoidl::ExceptionTypeEntity * >(ent.get()));
assert(ent2.is()); assert(ent2.is());
hasMember = dumpBaseMembers( out, ent2->getDirectBase(), withType, hasMember = dumpBaseMembers( out, ent2->getDirectBase(), withType,
withDefaults, parentsHadDirectMember || !ent2->getDirectMembers().empty() ); eligibleForDefaults && ent2->getDirectMembers().empty() );
int memberCount = 0; int memberCount = 0;
for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator
i(ent2->getDirectMembers().begin()); i(ent2->getDirectMembers().begin());
...@@ -3058,8 +3057,7 @@ bool ExceptionType::dumpBaseMembers( ...@@ -3058,8 +3057,7 @@ bool ExceptionType::dumpBaseMembers(
// We want to provide a default parameter value for uno::Exception subtype // 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 // constructors, since most of the time we don't pass a Context object in to the exception
// throw sites. // throw sites.
if (withDefaults if (eligibleForDefaults
&& !parentsHadDirectMember
&& base == "com.sun.star.uno.Exception" && base == "com.sun.star.uno.Exception"
&& memberCount == 1 && memberCount == 1
&& i->name == "Context" && i->name == "Context"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment