From: <xf...@us...> - 2014-02-03 21:56:24
|
Revision: 1901 http://sourceforge.net/p/scstudio/code/1901 Author: xfarmad Date: 2014-02-03 21:56:21 +0000 (Mon, 03 Feb 2014) Log Message: ----------- #92 EventAreaPtr->get_next_area() fix Modified Paths: -------------- trunk/src/data/msc/EventArea.cpp trunk/src/data/msc/EventArea.h Modified: trunk/src/data/msc/EventArea.cpp =================================================================== --- trunk/src/data/msc/EventArea.cpp 2014-02-03 14:36:12 UTC (rev 1900) +++ trunk/src/data/msc/EventArea.cpp 2014-02-03 21:56:21 UTC (rev 1901) @@ -19,14 +19,12 @@ #include "data/msc.h" #include "data/msc/EventArea.h" -const EventAreaPtr& EventArea::get_next_area() const +const EventAreaPtr EventArea::get_next_area() const { - static const EventAreaPtr null_ptr; - const EventAreaPtrList event_areas = get_instance()->get_areas(); - for (EventAreaPtrList::const_iterator i = event_areas.begin(); i != event_areas.end(); ++i) { + for (EventAreaPtrList::const_iterator i = get_instance()->get_areas().begin(); i != get_instance()->get_areas().end(); ++i) { if (i->get() == this) { ++i; - return (i == event_areas.end() ? null_ptr : *i); // NULL if this is the last event area on the instance + return (i == get_instance()->get_areas().end() ? NULL : *i); // NULL if this is the last event area on the instance } } throw std::runtime_error("the event area is not present in its instance area list"); @@ -34,11 +32,10 @@ EventArea* EventArea::get_previous_area() const { - const EventAreaPtrList event_areas = get_instance()->get_areas(); - for (EventAreaPtrList::const_reverse_iterator i = event_areas.rbegin(); i != event_areas.rend(); ++i) { + for (EventAreaPtrList::const_reverse_iterator i = get_instance()->get_areas().rbegin(); i != get_instance()->get_areas().rend(); ++i) { if (i->get() == this) { ++i; - return (i == event_areas.rend() ? NULL : i->get()); // NULL if this is the first event area on the instance + return (i == get_instance()->get_areas().rend() ? NULL : i->get()); // NULL if this is the first event area on the instance } } throw std::runtime_error("the event area is not present in its instance area list"); Modified: trunk/src/data/msc/EventArea.h =================================================================== --- trunk/src/data/msc/EventArea.h 2014-02-03 14:36:12 UTC (rev 1900) +++ trunk/src/data/msc/EventArea.h 2014-02-03 21:56:21 UTC (rev 1901) @@ -73,7 +73,7 @@ * Returns the next event area on the same instance, or intrusive NULL-pointer if this is the last one. * TODO: refactor out usages of this method where possible, use iteration instead */ - const EventAreaPtr& get_next_area() const; + const EventAreaPtr get_next_area() const; /** * Returns the previous event area on the same instance, or intrusive NULL-pointer if this is the first one. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |