reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit dc51a73eb31985fe8f47d6168fcd90696fd410ac
parent 1dd9e9f5ff61789bb1718965309301c4828b3b45
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Sat,  9 Apr 2016 02:28:09 -0400

some refactoring work over e3cf77c35d18ac90a3d2d4c4d7a1bba6d11ea1a0

Diffstat:
Msrc/browser.cpp | 48++++++++++++++++++++++++++----------------------
Msrc/browser.hpp | 1+
2 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/src/browser.cpp b/src/browser.cpp @@ -396,28 +396,7 @@ void Browser::populate() } } - auto actionIt = m_actions.begin(); - while(actionIt != m_actions.end()) - { - const Entry &oldEntry = *actionIt->first; - const Version *target = actionIt->second; - - const auto &entryIt = find(m_entries.begin(), m_entries.end(), oldEntry); - - actionIt = m_actions.erase(actionIt); - - if(entryIt == m_entries.end()) - continue; - - if(target) { - const Package *pkg = entryIt->package; - if(!pkg || !(target = pkg->findVersion(*target))) - continue; - } - - m_actions[&*entryIt] = target; - } - + transferActions(); fillList(); } catch(const reapack_error &e) { @@ -432,6 +411,31 @@ void Browser::populate() } } +void Browser::transferActions() +{ + auto actionIt = m_actions.begin(); + while(actionIt != m_actions.end()) + { + const Entry &oldEntry = *actionIt->first; + const Version *target = actionIt->second; + + const auto &entryIt = find(m_entries.begin(), m_entries.end(), oldEntry); + + actionIt = m_actions.erase(actionIt); + + if(entryIt == m_entries.end()) + continue; + + if(target) { + const Package *pkg = entryIt->package; + if(!pkg || !(target = pkg->findVersion(*target))) + continue; + } + + m_actions[&*entryIt] = target; + } +} + auto Browser::makeEntry(const Package *pkg, const Registry::Entry &regEntry) -> Entry { diff --git a/src/browser.hpp b/src/browser.hpp @@ -92,6 +92,7 @@ private: static Entry makeEntry(const Package *, const Registry::Entry &); void populate(); + void transferActions(); bool match(const Entry &) const; void checkFilter(); void fillList();