reapack

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

commit 2099e945fb5a27086d18110e810a79ffbefc138f
parent 8ab6aecb76b7c5896f78a4bc3440014655bcaa0b
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Thu, 27 Sep 2018 19:33:18 -0400

migrate from boost::optional to c++17 std::optional

Diffstat:
Msrc/browser.cpp | 16++++++++--------
Msrc/browser.hpp | 4++--
Msrc/browser_entry.hpp | 6+++---
Msrc/listview.cpp | 4++--
Msrc/listview.hpp | 6+++---
Msrc/manager.cpp | 12++++++------
Msrc/manager.hpp | 14+++++++-------
Msrc/transaction.cpp | 2+-
Msrc/transaction.hpp | 4++--
Mvendor/vcpkg-deps.txt | 2+-
10 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/src/browser.cpp b/src/browser.cpp @@ -173,7 +173,7 @@ void Browser::onCommand(const int id, const int event) g_reapack->manageRemotes(); break; case ACTION_FILTERTYPE: - m_typeFilter = boost::none; + m_typeFilter = nullopt; fillList(); break; case IDOK: @@ -697,7 +697,7 @@ void Browser::togglePin(const int index) const bool newVal = !entry->pin.value_or(entry->regEntry.pinned); if(newVal == entry->regEntry.pinned) - entry->pin = boost::none; + entry->pin = nullopt; else entry->pin = newVal; @@ -714,7 +714,7 @@ void Browser::toggleTarget(const int index, const Version *target) Entry *entry = getEntry(index); if(entry->target && *entry->target == target) - entry->target = boost::none; + entry->target = nullopt; else entry->target = target; @@ -726,7 +726,7 @@ void Browser::resetTarget(const int index) Entry *entry = getEntry(index); if(entry->target) { - entry->target = boost::none; + entry->target = nullopt; updateAction(index); } } @@ -736,9 +736,9 @@ void Browser::resetActions(const int index) Entry *entry = getEntry(index); if(entry->target) - entry->target = boost::none; + entry->target = nullopt; if(entry->pin) - entry->pin = boost::none; + entry->pin = nullopt; updateAction(index); } @@ -852,11 +852,11 @@ bool Browser::apply() else tx->uninstall(entry->regEntry); - entry->target = boost::none; + entry->target = nullopt; } else if(entry->pin) { tx->setPinned(entry->regEntry, *entry->pin); - entry->pin = boost::none; + entry->pin = nullopt; } } diff --git a/src/browser.hpp b/src/browser.hpp @@ -22,10 +22,10 @@ #include "package.hpp" -#include <boost/optional.hpp> #include <functional> #include <list> #include <memory> +#include <optional> #include <string> #include <vector> @@ -133,7 +133,7 @@ private: LoadState m_loadState; int m_currentIndex; - boost::optional<Package::Type> m_typeFilter; + std::optional<Package::Type> m_typeFilter; std::vector<Entry> m_entries; std::list<Entry *> m_actions; diff --git a/src/browser_entry.hpp b/src/browser_entry.hpp @@ -22,8 +22,8 @@ #include "listview.hpp" #include "registry.hpp" -#include <boost/optional.hpp> #include <memory> +#include <optional> class Index; class Menu; @@ -53,8 +53,8 @@ public: Entry(const Package *, const Registry::Entry &, const IndexPtr &); Entry(const Registry::Entry &, const IndexPtr &); - boost::optional<const Version *> target; - boost::optional<bool> pin; + std::optional<const Version *> target; + std::optional<bool> pin; std::string displayState() const; const std::string &indexName() const; diff --git a/src/listview.cpp b/src/listview.cpp @@ -337,8 +337,8 @@ void ListView::reset() m_cols.clear(); m_customizable = false; - m_sort = boost::none; - m_defaultSort = boost::none; + m_sort = nullopt; + m_defaultSort = nullopt; } void ListView::setSelected(const int index, const bool select) diff --git a/src/listview.hpp b/src/listview.hpp @@ -23,9 +23,9 @@ #include "filter.hpp" #include "serializer.hpp" -#include <boost/optional.hpp> #include <boost/signals2.hpp> #include <functional> +#include <optional> #include <vector> class Menu; @@ -201,8 +201,8 @@ private: bool m_customizable; std::vector<Column> m_cols; std::vector<RowPtr> m_rows; - boost::optional<Sort> m_sort; - boost::optional<Sort> m_defaultSort; + std::optional<Sort> m_sort; + std::optional<Sort> m_defaultSort; VoidSignal m_onSelect; VoidSignal m_onIconClick; diff --git a/src/manager.cpp b/src/manager.cpp @@ -353,7 +353,7 @@ void Manager::toggleEnabled() const bool enable = !mods->enable.value_or(remote.isEnabled()); if(remote.isEnabled() == enable) - mods->enable = boost::none; + mods->enable = nullopt; else mods->enable = enable; @@ -378,7 +378,7 @@ void Manager::setRemoteAutoInstall(const tribool &enabled) || (indeterminate(remote.autoInstall()) && indeterminate(enabled)); if(same) - mods->autoInstall = boost::none; + mods->autoInstall = nullopt; else mods->autoInstall = enabled; }); @@ -430,7 +430,7 @@ void Manager::uninstall() } } -void Manager::toggle(boost::optional<bool> &setting, const bool current) +void Manager::toggle(optional<bool> &setting, const bool current) { setting = !setting.value_or(current); setChange(*setting == current ? -1 : 1); @@ -655,9 +655,9 @@ void Manager::reset() { m_mods.clear(); m_uninstall.clear(); - m_autoInstall = boost::none; - m_bleedingEdge = boost::none; - m_promptObsolete = boost::none; + m_autoInstall = nullopt; + m_bleedingEdge = nullopt; + m_promptObsolete = nullopt; m_changes = 0; disable(m_apply); diff --git a/src/manager.hpp b/src/manager.hpp @@ -21,8 +21,8 @@ #include "dialog.hpp" #include <boost/logic/tribool.hpp> -#include <boost/optional.hpp> #include <map> +#include <optional> class ListView; class Menu; @@ -47,8 +47,8 @@ protected: private: struct RemoteMods { - boost::optional<bool> enable; - boost::optional<tribool> autoInstall; + std::optional<bool> enable; + std::optional<tribool> autoInstall; operator bool() const { return enable || autoInstall; } }; @@ -62,7 +62,7 @@ private: void setRemoteAutoInstall(const tribool &); tribool remoteAutoInstall(const Remote &) const; void uninstall(); - void toggle(boost::optional<bool> &, bool current); + void toggle(std::optional<bool> &, bool current); void refreshIndex(); void copyUrl(); void launchBrowser(); @@ -86,9 +86,9 @@ private: std::map<Remote, RemoteMods> m_mods; std::set<Remote> m_uninstall; - boost::optional<bool> m_autoInstall; - boost::optional<bool> m_bleedingEdge; - boost::optional<bool> m_promptObsolete; + std::optional<bool> m_autoInstall; + std::optional<bool> m_bleedingEdge; + std::optional<bool> m_promptObsolete; Serializer m_serializer; }; diff --git a/src/transaction.cpp b/src/transaction.cpp @@ -50,7 +50,7 @@ Transaction::Transaction() } void Transaction::synchronize(const Remote &remote, - const boost::optional<bool> forceAutoInstall) + const std::optional<bool> &forceAutoInstall) { if(m_syncedRemotes.count(remote.name())) return; diff --git a/src/transaction.hpp b/src/transaction.hpp @@ -23,10 +23,10 @@ #include "task.hpp" #include "thread.hpp" -#include <boost/optional.hpp> #include <boost/signals2.hpp> #include <functional> #include <memory> +#include <optional> #include <set> #include <unordered_set> @@ -56,7 +56,7 @@ public: void fetchIndexes(const std::vector<Remote> &, bool stale = false); std::vector<IndexPtr> getIndexes(const std::vector<Remote> &) const; void synchronize(const Remote &, - boost::optional<bool> forceAutoInstall = boost::none); + const std::optional<bool> &forceAutoInstall = std::nullopt); void install(const Version *, bool pin = false, const ArchiveReaderPtr & = nullptr); void install(const Version *, const Registry::Entry &oldEntry, bool pin = false, const ArchiveReaderPtr & = nullptr); diff --git a/vendor/vcpkg-deps.txt b/vendor/vcpkg-deps.txt @@ -1 +1 @@ -boost-algorithm boost-core boost-logic boost-mpl boost-optional boost-preprocessor boost-range boost-signals2 boost-variant catch2 curl sqlite3 +boost-algorithm boost-core boost-logic boost-mpl boost-preprocessor boost-range boost-signals2 boost-variant catch2 curl sqlite3