std::string create_summary(const grt::ListRef<GrtObject> &objects) { std::map<std::string, Summary> schema_summary; std::string summary= _("Summary of Reverse Engineered Objects:\n\n"); for(grt::ListRef<GrtObject>::const_iterator iter= objects.begin(); iter != objects.end(); ++iter) { std::string owner_name= (*iter)->owner()->name(); if ((*iter).is_instance<db_Schema>()) { if (schema_summary.find((*iter)->id()) == schema_summary.end()) { Summary s; schema_summary[(*iter)->name()]= s; } } else if ((*iter).is_instance<db_Table>()) schema_summary[owner_name].tables++; else if ((*iter).is_instance<db_View>()) schema_summary[owner_name].views++; else if ((*iter).is_instance<db_Routine>()) schema_summary[owner_name].routines++; } for (std::map<std::string,Summary>::const_iterator iter= schema_summary.begin(); iter != schema_summary.end(); ++iter) { if (iter->second.tables == 0 && iter->second.views == 0 && iter->second.routines == 0) summary.append(strfmt(_(" - empty schema '%s'\n"), iter->first.c_str())); else { summary.append(" - "); std::string sep= ""; if (iter->second.tables > 0) { summary.append(strfmt(_("%i tables"), iter->second.tables)); sep= ", "; } if (iter->second.views > 0) { summary.append(strfmt(_("%s%i views"), sep.c_str(), iter->second.views)); sep= ", "; } if (iter->second.routines > 0) { summary.append(strfmt(_("%s%i routines"), sep.c_str(), iter->second.routines)); sep= ", "; } summary.append(strfmt(_(" from schema '%s'\n"), iter->first.c_str())); } } return summary; }
virtual void refresh_children() { Node *add_node = 0; focused = 0; if (!children.empty()) { add_node = children.front(); children.erase(children.begin()); } clear_children(); if (add_node) children.push_back(add_node); for (size_t c = _list.count(), i = 0; i < c; i++) { db_DatabaseObjectRef object(_list[i]); SchemaObjectNode *node = _create_node(object); node->type = OverviewBE::OItem; node->label = object->name(); node->small_icon = IconManager::get_instance()->get_icon_id(object->get_metaclass(), Icon16); node->large_icon = IconManager::get_instance()->get_icon_id(object->get_metaclass(), Icon48); children.push_back(node); } // sort items after add_node std::sort(children.begin() + (add_node ? 1 : 0), children.end(), CompNodeLabel); }
/** **************************************************************************** * @brief Adds a list of plugins to the plugin registry * * @param list of plugins * **************************************************************************** */ void PluginManagerImpl::register_plugins(grt::ListRef<app_Plugin> plugins) { grt::ListRef<app_Plugin> list= get_plugin_list(); for (size_t c= plugins.count(), i= 0; i < c; i++) list.insert(plugins[i]); }
virtual void refresh_children() { Node *add_item= 0; if (!children.empty()) { add_item = children.front(); children.erase(children.begin()); } clear_children(); if (add_item) children.push_back(add_item); for (size_t c= _list.count(), i= 0; i < c; i++) { PrivilegeObjectNode *node= new PrivilegeObjectNode(_list[i], boost::bind(&RoleListNode::refresh, this, _1, _2)); node->type= OverviewBE::OItem; node->label= _list[i]->name(); node->small_icon= IconManager::get_instance()->get_icon_id(_list[i]->get_metaclass(), Icon16); node->large_icon= IconManager::get_instance()->get_icon_id(_list[i]->get_metaclass(), Icon48); node->remove= boost::bind(_remove, _1, db_RoleRef::cast_from(_list[i])); children.push_back(node); } }