void be_exception::GenerateConvenienceConstructor (be_ClientImplementation & source) { ostream & os = source.Stream (); const char * argPrefix = "_"; pbbool first = pbtrue; be_Tab tab (source); be_Type * btype; os << ScopedName () << "::" << LocalName () << " ("; UTL_Scope * s = (UTL_Scope*)narrow ((long) & UTL_Scope::type_id); assert (s); // Iterate through decls UTL_ScopeActiveIterator * it; for ( it = new UTL_ScopeActiveIterator (s, UTL_Scope::IK_decls); !it->is_done (); it->next () ) { AST_Decl * adecl = it->item (); assert (adecl); be_field *bfield = (be_field *)adecl->narrow ((long) & be_field::type_id); if (bfield) { btype = bfield->get_be_type (); if (!first) { os << ", "; } first = pbfalse; if (btype && btype->IsStringType ()) { // Strings are special case os << (char*) BE_Globals::RelativeScope (ScopedName (), bfield->InTypeName ()); } else { os << (char*) BE_Globals::RelativeScope (ScopedName (), bfield->StructMemberTypeName ()); } os << " " << argPrefix << (char*) bfield->get_local_name (); } } delete it; os << ")" << nl; // Iterate thru members initializing if (nmembers ()) { source.Indent (); first = pbtrue; for ( it = new UTL_ScopeActiveIterator (s, UTL_Scope::IK_decls); !it->is_done (); it->next () ) { AST_Decl * adecl = it->item (); assert (adecl); be_field *bfield = (be_field *)adecl->narrow ((long) & be_field::type_id); if (bfield) { btype = bfield->get_be_type (); // Array members are assigned in body of method if (btype && ! btype->IsArrayType ()) { if (first) { first = pbfalse; os << " : " << nl; } else { os << "," << nl; } os << " " << (char*) bfield->get_local_name () << "(" << argPrefix << (char*) bfield->get_local_name () << ")"; } } } delete it; source.Outdent (); } os << nl; os << tab << "{" << nl; for ( it = new UTL_ScopeActiveIterator (s, UTL_Scope::IK_decls); ! it->is_done (); it->next () ) { AST_Decl * adecl = it->item (); assert (adecl); be_field *bfield = (be_field *) adecl->narrow ((long) & be_field::type_id); if (bfield) { btype = bfield->get_be_type (); if (btype && btype->IsArrayType ()) { // Need to copy array elements os << " " << (char*) BE_Globals::RelativeScope (ScopedName (), bfield->StructMemberTypeName ()) << "_copy (" << argPrefix << bfield->get_local_name () << ", " << bfield->get_local_name () << ");" << nl; } } } delete it; os << "}" << nl << nl; }