From c1d6741fd527ffdaa35a33fd8798d1c4a462bb56 Mon Sep 17 00:00:00 2001 From: david Date: Sun, 19 Jan 2003 23:03:31 +0000 Subject: [PATCH] Go back to the simpler arrangement syntax of a map of vectors. --- src/GUI/menubar.cxx | 17 +++++++---------- src/GUI/menubar.hxx | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/GUI/menubar.cxx b/src/GUI/menubar.cxx index b79894cd0..3d1049bac 100644 --- a/src/GUI/menubar.cxx +++ b/src/GUI/menubar.cxx @@ -282,12 +282,11 @@ FGMenuBar::~FGMenuBar () delete _menuBar; // FIXME: check if PUI owns the pointer // Delete all those bindings - map*>::iterator it; + map >::iterator it; it = _bindings.begin(); while (it != _bindings.end()) { - for (int i = 0; i < it->second->size(); i++) - delete (*it->second)[i]; - delete it->second; + for (int i = 0; i < it->second.size(); i++) + delete it->second[i]; } } @@ -329,10 +328,10 @@ void FGMenuBar::fireItem (puObject * item) { const char * name = item->getLegend(); - vector * bindings = _bindings[name]; + vector &bindings = _bindings[name]; - for (int i = 0; i < bindings->size(); i++) - (*bindings)[i]->fire(); + for (int i = 0; i < bindings.size(); i++) + bindings[i]->fire(); } void @@ -358,10 +357,8 @@ FGMenuBar::make_menu (SGPropertyNode_ptr node) vector binding_nodes = item_nodes[i]->getChildren("binding"); - if (_bindings[items[j]] == 0) - _bindings[items[j]] = new vector; for (int k = 0; k < binding_nodes.size(); k++) - _bindings[items[j]]->push_back(new FGBinding(binding_nodes[k])); + _bindings[items[j]].push_back(new FGBinding(binding_nodes[k])); } items[item_nodes.size()] = 0; diff --git a/src/GUI/menubar.hxx b/src/GUI/menubar.hxx index 12ee7a56e..4dabf20c7 100644 --- a/src/GUI/menubar.hxx +++ b/src/GUI/menubar.hxx @@ -82,7 +82,7 @@ private: bool _visible; puMenuBar * _menuBar; - map*> _bindings; + map > _bindings; }; #endif // __MENUBAR_HXX -- 2.39.5