13
0

Reduce reliance on boost - the easy part

* boost::unordered_map -> std::unordered_map
* BOOST_STATIC_ASSERT/static_assert
* BOOST_FOREACH -> for
* boost::tuple -> std::tuple/g
* boost::math::isnormal -> std::isnormal
* boost::container::set -> std::set
* boost::none -> std::nullopt
* boost::optional -> std::optional
This commit is contained in:
Robin Gareus 2024-10-19 02:23:13 +02:00
parent 168b917730
commit ff95d81612
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
58 changed files with 144 additions and 155 deletions

View File

@ -1459,7 +1459,7 @@ ARDOUR_UI::update_disk_space()
return;
}
boost::optional<samplecnt_t> opt_samples = _session->available_capture_duration();
std::optional<samplecnt_t> opt_samples = _session->available_capture_duration();
samplecnt_t fr = _session->sample_rate();
if (fr == 0) {

View File

@ -24,7 +24,7 @@
#pragma once
#include <list>
#include <boost/unordered_map.hpp>
#include <unordered_map>
#include <gtkmm/label.h>
#include <gtkmm/table.h>
@ -133,6 +133,6 @@ protected:
Gtk::Label inactive_label;
Gtk::Table inactive_table;
mutable boost::unordered_map<std::string, std::string> property_hashtable;
mutable std::unordered_map<std::string, std::string> property_hashtable;
}; /* class AxisView */

View File

@ -46,7 +46,6 @@
* Apple's MacTypes.h and BarController.
*/
#include <boost/none.hpp>
#include <sigc++/bind.h>
@ -1018,7 +1017,7 @@ Editor::deferred_control_scroll (samplepos_t /*target*/)
{
_session->request_locate (*_control_scroll_target);
/* reset for next stream */
_control_scroll_target = boost::none;
_control_scroll_target = std::nullopt;
_dragging_playhead = false;
return false;
}

View File

@ -42,7 +42,7 @@
#include <string>
#include <vector>
#include <boost/optional.hpp>
#include <optional>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/layout.h>
@ -532,7 +532,7 @@ private:
bool constructed;
// to keep track of the playhead position for control_scroll
boost::optional<samplepos_t> _control_scroll_target;
std::optional<samplepos_t> _control_scroll_target;
SelectionPropertiesBox* _properties_box;
@ -580,7 +580,7 @@ private:
void update_join_object_range_location (double);
boost::optional<float> pre_notebook_shrink_pane_width;
std::optional<float> pre_notebook_shrink_pane_width;
Gtk::VBox _editor_list_vbox;
Gtk::Notebook _the_notebook;

View File

@ -152,7 +152,7 @@ bool
Editor::canvas_scroll_event (GdkEventScroll *event, bool from_canvas)
{
if (from_canvas) {
boost::optional<ArdourCanvas::Rect> rulers = _time_markers_group->bounding_box();
std::optional<ArdourCanvas::Rect> rulers = _time_markers_group->bounding_box();
if (rulers && rulers->contains (Duple (event->x, event->y))) {
return canvas_ruler_event ((GdkEvent*) event, timecode_ruler, TimecodeRulerItem);
}

View File

@ -1393,7 +1393,7 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
/* How high is this region view ? */
boost::optional<ArdourCanvas::Rect> obbox = rv->get_canvas_group ()->bounding_box ();
std::optional<ArdourCanvas::Rect> obbox = rv->get_canvas_group ()->bounding_box ();
ArdourCanvas::Rect bbox;
if (obbox) {
@ -5122,7 +5122,7 @@ FeatureLineDrag::motion (GdkEvent*, bool)
cx = 0;
}
boost::optional<ArdourCanvas::Rect> bbox = _line->bounding_box ();
std::optional<ArdourCanvas::Rect> bbox = _line->bounding_box ();
assert (bbox);
_line->set (ArdourCanvas::Duple (cx, 2.0), ArdourCanvas::Duple (cx, bbox.value ().height ()));

View File

@ -19,7 +19,7 @@
#ifndef _gtk_ardour_editor_sections_h_
#define _gtk_ardour_editor_sections_h_
#include <boost/unordered_map.hpp>
#include <unordered_map>
#include "ardour/location.h"
#include "ardour/session_handle.h"
@ -108,7 +108,7 @@ private:
Gtk::TreeModelColumn<Temporal::timepos_t> end;
};
typedef boost::unordered_map<ARDOUR::Location*, Gtk::TreeModel::iterator> LocationRowMap;
typedef std::unordered_map<ARDOUR::Location*, Gtk::TreeModel::iterator> LocationRowMap;
Columns _columns;
Glib::RefPtr<Gtk::ListStore> _model;

View File

@ -1,7 +1,7 @@
#ifndef __gtk2_ardour_ghost_event_h__
#define __gtk2_ardour_ghost_event_h__
#include <boost/unordered_map.hpp>
#include <unordered_map>
#include <sigc++/trackable.h>
#include "evoral/Note.h"
@ -28,7 +28,7 @@ class GhostEvent : public sigc::trackable
/* must match typedef in NoteBase */
typedef Evoral::Note<Temporal::Beats> NoteType;
typedef boost::unordered_map<std::shared_ptr<NoteType>, GhostEvent* > EventList;
typedef std::unordered_map<std::shared_ptr<NoteType>, GhostEvent* > EventList;
static GhostEvent* find (std::shared_ptr<NoteType> parent, EventList& events, EventList::iterator& opti);
};

View File

@ -28,7 +28,7 @@
#include <vector>
#include <stdint.h>
#include <boost/unordered_map.hpp>
#include <unordered_map>
#include <sigc++/signal.h>
@ -478,9 +478,9 @@ class MidiView : public virtual sigc::trackable, public LineMerger
uint8_t get_velocity_for_add (ARDOUR::MidiModel::TimeType time) const;
uint8_t get_channel_for_add (ARDOUR::MidiModel::TimeType time) const;
typedef boost::unordered_map<std::shared_ptr<NoteType>, NoteBase*> Events;
typedef boost::unordered_map<ARDOUR::MidiModel::PatchChangePtr, std::shared_ptr<PatchChange> > PatchChanges;
typedef boost::unordered_map<ARDOUR::MidiModel::constSysExPtr, std::shared_ptr<SysEx> > SysExes;
typedef std::unordered_map<std::shared_ptr<NoteType>, NoteBase*> Events;
typedef std::unordered_map<ARDOUR::MidiModel::PatchChangePtr, std::shared_ptr<PatchChange> > PatchChanges;
typedef std::unordered_map<ARDOUR::MidiModel::constSysExPtr, std::shared_ptr<SysEx> > SysExes;
typedef std::vector<NoteBase*> CopyDragEvents;
std::shared_ptr<ARDOUR::MidiTrack> _midi_track;

View File

@ -19,7 +19,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <boost/foreach.hpp>
#include "gtkmm2ext/utils.h"
@ -197,7 +196,7 @@ RouteList
MixerGroupTabs::selected_routes () const
{
RouteList rl;
BOOST_FOREACH (AxisView* r, _mixer->selection().axes) {
for (AxisView* r : _mixer->selection().axes) {
std::shared_ptr<Route> rp = std::dynamic_pointer_cast<Route> (r->stripable());
if (rp) {
rl.push_back (rp);

View File

@ -1838,24 +1838,24 @@ MixerStrip::parameter_changed (string p)
*
* @return optional value that is present if visibility state should be overridden.
*/
boost::optional<bool>
std::optional<bool>
MixerStrip::override_solo_visibility () const
{
if (is_master ()) {
return boost::optional<bool> (false);
return std::optional<bool> (false);
}
return boost::optional<bool> ();
return std::optional<bool> ();
}
boost::optional<bool>
std::optional<bool>
MixerStrip::override_rec_mon_visibility () const
{
if (is_master ()) {
return boost::optional<bool> (false);
return std::optional<bool> (false);
}
return boost::optional<bool> ();
return std::optional<bool> ();
}

View File

@ -311,8 +311,8 @@ private:
* the RC option editor.
*/
VisibilityGroup _visibility;
boost::optional<bool> override_solo_visibility () const;
boost::optional<bool> override_rec_mon_visibility () const;
std::optional<bool> override_solo_visibility () const;
std::optional<bool> override_rec_mon_visibility () const;
PBD::ScopedConnectionList _config_connection;

View File

@ -33,7 +33,6 @@
#include <map>
#include <sigc++/bind.h>
#include <boost/foreach.hpp>
#include <glibmm/threads.h>
@ -3775,7 +3774,7 @@ Mixer_UI::control_action (std::shared_ptr<T> (Stripable::*get_control)() const)
set_axis_targets_for_operation ();
BOOST_FOREACH(AxisView* r, _axis_targets) {
for (AxisView* r : _axis_targets) {
std::shared_ptr<Stripable> s = r->stripable();
if (s) {
ac = (s.get()->*get_control)();
@ -3816,7 +3815,7 @@ Mixer_UI::selected_gaincontrols ()
{
set_axis_targets_for_operation ();
ControllableSet rv;
BOOST_FOREACH(AxisView* r, _axis_targets) {
for (AxisView* r : _axis_targets) {
MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
if (ms) {
std::shared_ptr<GainControl> ac (ms->route()->gain_control());
@ -3857,7 +3856,7 @@ Mixer_UI::unity_gain_action ()
{
set_axis_targets_for_operation ();
BOOST_FOREACH(AxisView* r, _axis_targets) {
for (AxisView* r : _axis_targets) {
std::shared_ptr<Stripable> s = r->stripable();
if (s) {
std::shared_ptr<AutomationControl> ac = s->gain_control();
@ -3873,7 +3872,7 @@ Mixer_UI::copy_processors ()
{
set_axis_targets_for_operation ();
BOOST_FOREACH(AxisView* r, _axis_targets) {
for (AxisView* r : _axis_targets) {
MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
if (ms) {
ms->copy_processors ();
@ -3885,7 +3884,7 @@ Mixer_UI::cut_processors ()
{
set_axis_targets_for_operation ();
BOOST_FOREACH(AxisView* r, _axis_targets) {
for (AxisView* r : _axis_targets) {
MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
if (ms) {
ms->cut_processors ();
@ -3897,7 +3896,7 @@ Mixer_UI::paste_processors ()
{
set_axis_targets_for_operation ();
BOOST_FOREACH(AxisView* r, _axis_targets) {
for (AxisView* r : _axis_targets) {
MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
if (ms) {
ms->paste_processors ();
@ -3909,7 +3908,7 @@ Mixer_UI::select_all_processors ()
{
set_axis_targets_for_operation ();
BOOST_FOREACH(AxisView* r, _axis_targets) {
for (AxisView* r : _axis_targets) {
MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
if (ms) {
ms->select_all_processors ();
@ -3921,7 +3920,7 @@ Mixer_UI::toggle_processors ()
{
set_axis_targets_for_operation ();
BOOST_FOREACH(AxisView* r, _axis_targets) {
for (AxisView* r : _axis_targets) {
MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
if (ms) {
ms->toggle_processors ();
@ -3933,7 +3932,7 @@ Mixer_UI::ab_plugins ()
{
set_axis_targets_for_operation ();
BOOST_FOREACH(AxisView* r, _axis_targets) {
for (AxisView* r : _axis_targets) {
MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
if (ms) {
ms->ab_plugins ();
@ -3945,7 +3944,7 @@ void
Mixer_UI::vca_assign (std::shared_ptr<VCA> vca)
{
set_axis_targets_for_operation ();
BOOST_FOREACH(AxisView* r, _axis_targets) {
for (AxisView* r : _axis_targets) {
MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
if (ms) {
ms->vca_assign (vca);
@ -3957,7 +3956,7 @@ void
Mixer_UI::vca_unassign (std::shared_ptr<VCA> vca)
{
set_axis_targets_for_operation ();
BOOST_FOREACH(AxisView* r, _axis_targets) {
for (AxisView* r : _axis_targets) {
MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
if (ms) {
ms->vca_unassign (vca);

View File

@ -252,7 +252,7 @@ NoteBase::set_mouse_fractions (GdkEvent* ev)
return;
}
boost::optional<ArdourCanvas::Rect> bbox = _item->bounding_box ();
std::optional<ArdourCanvas::Rect> bbox = _item->bounding_box ();
assert (bbox);
_item->canvas_to_item (ix, iy);

View File

@ -318,7 +318,7 @@ RemainInfoBox::render (Cairo::RefPtr<Cairo::Context> const& cr, cairo_rectangle_
}
samplecnt_t sample_rate = _session->nominal_sample_rate ();
boost::optional<samplecnt_t> opt_samples = _session->available_capture_duration ();
std::optional<samplecnt_t> opt_samples = _session->available_capture_duration ();
Gtkmm2ext::set_source_rgb_a (cr, UIConfiguration::instance ().color ("widget:bg"), .7);

View File

@ -22,7 +22,7 @@
#ifndef _gtk_ardour_region_list_base_h_
#define _gtk_ardour_region_list_base_h_
#include <boost/unordered_map.hpp>
#include <unordered_map>
#include <gtkmm/celleditable.h>
#include <gtkmm/frame.h>
@ -236,7 +236,7 @@ protected:
bool _no_redisplay;
typedef boost::unordered_map<std::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::iterator> RegionRowMap;
typedef std::unordered_map<std::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::iterator> RegionRowMap;
RegionRowMap region_row_map;

View File

@ -50,7 +50,7 @@ VisibilityGroup::VisibilityGroup (std::string const & name)
*/
void
VisibilityGroup::add (Gtk::Widget* widget, string const & id, string const & name, bool visible, boost::function<boost::optional<bool> ()> override)
VisibilityGroup::add (Gtk::Widget* widget, string const & id, string const & name, bool visible, boost::function<std::optional<bool> ()> override)
{
Member m;
m.widget = widget;
@ -92,7 +92,7 @@ bool
VisibilityGroup::should_actually_be_visible (Member const & m) const
{
if (m.override) {
boost::optional<bool> o = m.override ();
std::optional<bool> o = m.override ();
if (o) {
return o.value ();
}

View File

@ -41,7 +41,7 @@ public:
std::string const &,
std::string const &,
bool visible = false,
boost::function<boost::optional<bool> ()> = 0
boost::function<std::optional<bool> ()> = 0
);
Gtk::Widget* list_view ();
@ -64,7 +64,7 @@ private:
std::string id;
std::string name;
bool visible;
boost::function<boost::optional<bool> ()> override;
boost::function<std::optional<bool> ()> override;
};
class ModelColumns : public Gtk::TreeModelColumnRecord {

View File

@ -22,7 +22,7 @@
#include <atomic>
#include <boost/optional.hpp>
#include <optional>
#include "evoral/Curve.h"
@ -210,8 +210,8 @@ private:
sampleoffset_t _declick_offs;
bool _declick_enabled;
MidiNoteTracker _tracker;
boost::optional<bool> _last_read_reversed;
boost::optional<bool> _last_read_loop;
std::optional<bool> _last_read_reversed;
std::optional<bool> _last_read_loop;
static samplecnt_t _chunk_samples;

View File

@ -22,7 +22,7 @@
#include <atomic>
#include <list>
#include <vector>
#include <boost/optional.hpp>
#include <optional>
#include "ardour/disk_io.h"
#include "ardour/event_ring_buffer.h"
@ -171,7 +171,7 @@ private:
samplepos_t get_capture_start_sample_locked (uint32_t n = 0) const;
boost::optional<samplepos_t> _capture_start_sample;
std::optional<samplepos_t> _capture_start_sample;
samplecnt_t _capture_captured;
bool _was_recording;

View File

@ -35,7 +35,7 @@
#include <sys/stat.h>
#include <boost/optional.hpp>
#include <optional>
#include <glib.h>
@ -471,7 +471,7 @@ private:
void coalesce_and_check_crossfades (std::list<Temporal::TimeRange>);
std::shared_ptr<RegionList> find_regions_at (timepos_t const &);
mutable boost::optional<std::pair<timepos_t, timepos_t> > _cached_extent;
mutable std::optional<std::pair<timepos_t, timepos_t> > _cached_extent;
timepos_t _end_space; //this is used when we are pasting a range with extra space at the end
bool _playlist_shift_active;

View File

@ -31,7 +31,6 @@
#include <map>
#include <string>
#include <set>
#include <boost/container/set.hpp>
#include "ardour/libardour_visibility.h"
#include "ardour/types.h"
@ -193,7 +192,7 @@ private:
}
};
typedef boost::container::set<PSLEPtr, PSLEPtrSort> PluginScanLog;
typedef std::set<PSLEPtr, PSLEPtrSort> PluginScanLog;
PluginScanLog _plugin_scan_log;
PSLEPtr scan_log_entry (PluginType const type, std::string const& path) {

View File

@ -768,7 +768,7 @@ public:
samplepos_t audible_sample (bool* latent_locate = NULL) const;
samplepos_t requested_return_sample() const { return _requested_return_sample; }
void set_requested_return_sample(samplepos_t return_to);
boost::optional<samplepos_t> const & nominal_jack_transport_sample() { return _nominal_jack_transport_sample; }
std::optional<samplepos_t> const & nominal_jack_transport_sample() { return _nominal_jack_transport_sample; }
bool compute_audible_delta (samplepos_t& pos_and_delta) const;
samplecnt_t remaining_latency_preroll () const { return _remaining_latency_preroll; }
@ -1051,7 +1051,7 @@ public:
/* s/w "RAID" management */
boost::optional<samplecnt_t> available_capture_duration();
std::optional<samplecnt_t> available_capture_duration();
/* I/O bundles */
@ -1435,8 +1435,8 @@ private:
void add_surround_master ();
void remove_surround_master ();
boost::optional<bool> _vapor_available;
boost::optional<bool> _vapor_exportable;
std::optional<bool> _vapor_available;
std::optional<bool> _vapor_exportable;
void update_latency (bool playback);
void set_owned_port_public_latency (bool playback);
@ -2317,7 +2317,7 @@ private:
CoreSelection* _selection;
bool _global_locate_pending;
boost::optional<samplepos_t> _nominal_jack_transport_sample;
std::optional<samplepos_t> _nominal_jack_transport_sample;
bool _had_destructive_tracks;

View File

@ -21,7 +21,7 @@
#pragma once
#include <boost/optional.hpp>
#include <optional>
#include <memory>
#include "pbd/enum_convert.h"
@ -196,7 +196,7 @@ protected:
void update_input_meter ();
std::shared_ptr<Playlist> _playlists[DataType::num_types];
boost::optional<MeterPoint> _saved_meter_point;
std::optional<MeterPoint> _saved_meter_point;
bool _record_prepared;
TrackMode _mode;

View File

@ -5,7 +5,7 @@
#include <queue>
#include <boost/intrusive/list.hpp>
#include <boost/optional.hpp>
#include <optional>
#include <string>
#include <utility>
@ -208,7 +208,7 @@ struct TransportFSM
EventList queued_events;
EventList deferred_events;
int processing;
mutable boost::optional<bool> current_roll_after_locate_status;
mutable std::optional<bool> current_roll_after_locate_status;
mutable double most_recently_requested_speed;
mutable double _default_speed;
int _reverse_after_declick;

View File

@ -20,7 +20,7 @@
#include <vector>
#include <boost/optional.hpp>
#include <optional>
#include <glibmm/threads.h>
#include <glibmm/timer.h>
@ -152,7 +152,7 @@ public:
static std::shared_ptr<TransportMaster> factory (SyncSource, std::string const&, bool removeable);
static std::shared_ptr<TransportMaster> factory (XMLNode const&);
virtual void pre_process (pframes_t nframes, samplepos_t now, boost::optional<samplepos_t>) = 0;
virtual void pre_process (pframes_t nframes, samplepos_t now, std::optional<samplepos_t>) = 0;
/**
* This is the most important function to implement:
@ -513,7 +513,7 @@ public:
void set_session (Session*);
void pre_process (pframes_t nframes, samplepos_t now, boost::optional<samplepos_t>);
void pre_process (pframes_t nframes, samplepos_t now, std::optional<samplepos_t>);
void unregister_port ();
@ -585,7 +585,7 @@ public:
void set_session (Session*);
void pre_process (pframes_t nframes, samplepos_t now, boost::optional<samplepos_t>);
void pre_process (pframes_t nframes, samplepos_t now, std::optional<samplepos_t>);
void reset (bool with_pos);
bool locked () const;
@ -666,7 +666,7 @@ public:
void unregister_port ();
void pre_process (pframes_t nframes, samplepos_t now, boost::optional<samplepos_t>);
void pre_process (pframes_t nframes, samplepos_t now, std::optional<samplepos_t>);
void rebind (MidiPort&);
@ -737,7 +737,7 @@ public:
Engine_TransportMaster (AudioEngine&);
~Engine_TransportMaster ();
void pre_process (pframes_t nframes, samplepos_t now, boost::optional<samplepos_t>);
void pre_process (pframes_t nframes, samplepos_t now, std::optional<samplepos_t>);
bool speed_and_position (double& speed, samplepos_t& pos, samplepos_t&, samplepos_t&, samplepos_t);
bool starting () const

View File

@ -117,7 +117,7 @@ class LIBARDOUR_API TransportMasterManager
static TransportMasterManager* _instance;
/* original TC format in case the slave changed it */
boost::optional<Timecode::TimecodeFormat> _session_tc_format;
std::optional<Timecode::TimecodeFormat> _session_tc_format;
void maybe_restore_tc_format ();
void maybe_set_tc_format ();

View File

@ -23,7 +23,7 @@
#include <set>
#include <vector>
#include <boost/optional.hpp>
#include <optional>
#include <glibmm/threads.h>
#include "pbd/search_path.h"
@ -328,8 +328,8 @@ private:
std::set<Evoral::Parameter> _ac_subscriptions;
bool _add_to_selection;
boost::optional<uint32_t> _plugin_latency;
boost::optional<uint32_t> _plugin_tail;
std::optional<uint32_t> _plugin_latency;
std::optional<uint32_t> _plugin_tail;
int _n_bus_in;
int _n_bus_out;
@ -486,7 +486,7 @@ public:
bool is_instrument () const;
PBD::Searchpath preset_search_path () const;
boost::optional<bool> has_editor;
std::optional<bool> has_editor;
std::shared_ptr<VST3PluginModule> m;
};

View File

@ -18,7 +18,6 @@
*/
#include <algorithm>
#include <boost/math/special_functions/fpclassify.hpp>
#include <cmath>
#include <stdlib.h>
@ -135,7 +134,7 @@ LowPass::proc (float* data, const uint32_t n_samples)
_z = z;
if (!isfinite_local (_z)) {
_z = 0;
} else if (!boost::math::isnormal (_z)) {
} else if (!std::isnormal (_z)) {
_z = 0;
}
}
@ -192,12 +191,12 @@ Biquad::run (float* data, const uint32_t n_samples)
if (!isfinite_local (_z1)) {
_z1 = 0;
} else if (!boost::math::isnormal (_z1)) {
} else if (!std::isnormal (_z1)) {
_z1 = 0;
}
if (!isfinite_local (_z2)) {
_z2 = 0;
} else if (!boost::math::isnormal (_z2)) {
} else if (!std::isnormal (_z2)) {
_z2 = 0;
}
}

View File

@ -82,7 +82,7 @@ Engine_TransportMaster::ok() const
}
void
Engine_TransportMaster::pre_process (pframes_t, samplepos_t, boost::optional<samplepos_t>)
Engine_TransportMaster::pre_process (pframes_t, samplepos_t, std::optional<samplepos_t>)
{
/* nothing to do */
}

View File

@ -224,7 +224,7 @@ IO::remove_port (std::shared_ptr<Port> port, void* src)
ChanCount after = before;
after.set (port->type(), after.get (port->type()) - 1);
boost::optional<bool> const r = PortCountChanging (after); /* EMIT SIGNAL */
std::optional<bool> const r = PortCountChanging (after); /* EMIT SIGNAL */
if (r.value_or (false)) {
return -1;
}
@ -296,7 +296,7 @@ IO::add_port (string destination, void* src, DataType type)
ChanCount after = before;
after.set (type, after.get (type) + 1);
boost::optional<bool> const r = PortCountChanging (after); /* EMIT SIGNAL */
std::optional<bool> const r = PortCountChanging (after); /* EMIT SIGNAL */
if (r.value_or (false)) {
return -1;
}

View File

@ -564,7 +564,7 @@ LTC_TransportMaster::process_ltc(samplepos_t const now)
}
void
LTC_TransportMaster::pre_process (ARDOUR::pframes_t nframes, samplepos_t now, boost::optional<samplepos_t> session_pos)
LTC_TransportMaster::pre_process (ARDOUR::pframes_t nframes, samplepos_t now, std::optional<samplepos_t> session_pos)
{
if (!_port) {
reset (true);

View File

@ -115,7 +115,7 @@ MIDIClock_TransportMaster::set_session (Session* s)
}
void
MIDIClock_TransportMaster::pre_process (MIDI::pframes_t nframes, samplepos_t now, boost::optional<samplepos_t> session_pos)
MIDIClock_TransportMaster::pre_process (MIDI::pframes_t nframes, samplepos_t now, std::optional<samplepos_t> session_pos)
{
/* Read and parse incoming MIDI */
if (!_midi_port) {

View File

@ -125,7 +125,7 @@ MTC_TransportMaster::set_session (Session* s)
}
void
MTC_TransportMaster::pre_process (MIDI::pframes_t nframes, samplepos_t now, boost::optional<samplepos_t> session_pos)
MTC_TransportMaster::pre_process (MIDI::pframes_t nframes, samplepos_t now, std::optional<samplepos_t> session_pos)
{
/* Read and parse incoming MIDI */

View File

@ -1128,7 +1128,7 @@ Route::add_processors (const ProcessorList& others, std::shared_ptr<Processor> b
flags &= mask;
if (flags != None) {
boost::optional<int> rv = PluginSetup (std::dynamic_pointer_cast<Route>(shared_from_this ()), pi, flags); /* EMIT SIGNAL */
std::optional<int> rv = PluginSetup (std::dynamic_pointer_cast<Route>(shared_from_this ()), pi, flags); /* EMIT SIGNAL */
int mode = rv.value_or (0);
switch (mode & 3) {
case 1:

View File

@ -5815,13 +5815,13 @@ Session::graph_reordered (bool called_from_backend)
/** @return Number of samples that there is disk space available to write,
* if known.
*/
boost::optional<samplecnt_t>
std::optional<samplecnt_t>
Session::available_capture_duration ()
{
Glib::Threads::Mutex::Lock lm (space_lock);
if (_total_free_4k_blocks_uncertain) {
return boost::optional<samplecnt_t> ();
return std::optional<samplecnt_t> ();
}
float sample_bytes_on_disk = 4.0; // keep gcc happy

View File

@ -978,7 +978,7 @@ Session::load_state (string snapshot_name, bool from_template)
/* there is pending state from a crashed capture attempt */
boost::optional<int> r = AskAboutPendingState();
std::optional<int> r = AskAboutPendingState();
if (r.value_or (1)) {
state_was_pending = true;
} else {
@ -1717,7 +1717,7 @@ Session::set_state (const XMLNode& node, int version)
bool reconfigured = false;
while (!AudioEngine::instance()->running () || _base_sample_rate != AudioEngine::instance()->sample_rate ()) {
boost::optional<int> r = AskAboutSampleRateMismatch (_base_sample_rate, _current_sample_rate);
std::optional<int> r = AskAboutSampleRateMismatch (_base_sample_rate, _current_sample_rate);
int rv = r.value_or (0);
if (rv == 0 && AudioEngine::instance()->running ()) {
/* continue with rate mismatch */
@ -3482,7 +3482,7 @@ struct RegionCounter {
int
Session::ask_about_playlist_deletion (std::shared_ptr<Playlist> p)
{
boost::optional<int> r = AskAboutPlaylistDeletion (p);
std::optional<int> r = AskAboutPlaylistDeletion (p);
return r.value_or (1);
}
@ -5296,7 +5296,7 @@ Session::save_as (SaveAs& saveas)
/* tell someone "X percent, file M of N"; M is one-based */
boost::optional<bool> res = saveas.Progress (fraction, cnt, all);
std::optional<bool> res = saveas.Progress (fraction, cnt, all);
if (res) {
keep_going = *res;

View File

@ -190,7 +190,7 @@ Session::locate (samplepos_t target_sample, bool for_loop_end, bool force, bool
// Update Timecode time
_transport_sample = target_sample;
_nominal_jack_transport_sample = boost::none;
_nominal_jack_transport_sample = std::nullopt;
/* Note that loop wrap-around locates do not need to call "seek" */
if (force || !for_loop_end) {

View File

@ -87,7 +87,7 @@ bool
TempoMapImporter::_prepare_move ()
{
// Prompt user for verification
boost::optional<bool> replace = Prompt (_("This will replace the current tempo map!\nAre you sure you want to do this?"));
std::optional<bool> replace = Prompt (_("This will replace the current tempo map!\nAre you sure you want to do this?"));
return replace.value_or (false);
}

View File

@ -19,7 +19,6 @@
#include <sstream>
#include <boost/none.hpp>
#include "pbd/error.h"
#include "pbd/pthread_utils.h"
@ -104,7 +103,7 @@ TransportFSM::hard_stop ()
{
_motion_state = Stopped;
_last_locate.target = max_samplepos;
current_roll_after_locate_status = boost::none;
current_roll_after_locate_status = std::nullopt;
_direction_state = Forwards;
_transport_speed = 0;
_reverse_after_declick = 0;
@ -484,7 +483,7 @@ TransportFSM::start_playback ()
DEBUG_TRACE (DEBUG::TFSMEvents, "start_playback\n");
_last_locate.target = max_samplepos;
current_roll_after_locate_status = boost::none;
current_roll_after_locate_status = std::nullopt;
if (most_recently_requested_speed == std::numeric_limits<double>::max()) {
/* we started rolling without ever setting speed; that's an implicit
@ -504,7 +503,7 @@ TransportFSM::stop_playback (Event const & s)
DEBUG_TRACE (DEBUG::TFSMEvents, "stop_playback\n");
_last_locate.target = max_samplepos;
current_roll_after_locate_status = boost::none;
current_roll_after_locate_status = std::nullopt;
api->stop_transport (s.abort_capture, s.clear_state);
}
@ -684,7 +683,7 @@ bool
TransportFSM::should_roll_after_locate () const
{
bool roll = current_roll_after_locate_status.value_or (api->should_roll_after_locate ());
current_roll_after_locate_status = boost::none; // used it
current_roll_after_locate_status = std::nullopt; // used it
DEBUG_TRACE (DEBUG::TFSMEvents, string_compose ("should_roll_after_locate() ? %1\n", roll));
return roll;
@ -695,7 +694,7 @@ TransportFSM::roll_after_locate () const
{
bool for_loop = _last_locate.for_loop_end;
DEBUG_TRACE (DEBUG::TFSMEvents, string_compose ("rolling after locate, was for_loop ? %1\n", for_loop));
current_roll_after_locate_status = boost::none;
current_roll_after_locate_status = std::nullopt;
if (most_recently_requested_speed == std::numeric_limits<double>::max()) {
/* we started rolling without ever setting speed; that's an implicit

View File

@ -160,7 +160,7 @@ TransportMasterManager::pre_process_transport_masters (pframes_t nframes, sample
return 1.0;
}
boost::optional<samplepos_t> session_pos;
std::optional<samplepos_t> session_pos;
if (_session) {
session_pos = _session->audible_sample();

View File

@ -30,7 +30,7 @@
#endif
#if SMTG_OS_LINUX
#include <boost/unordered_map.hpp>
#include <unordered_map>
#include <glibmm.h>
#endif
@ -102,8 +102,8 @@ private:
guint _source_id;
};
boost::unordered_map<FileDescriptor, EventHandler> _event_handlers;
boost::unordered_map<guint, Linux::ITimerHandler*> _timer_handlers;
std::unordered_map<FileDescriptor, EventHandler> _event_handlers;
std::unordered_map<guint, Linux::ITimerHandler*> _timer_handlers;
static gboolean event (GIOChannel* source, GIOCondition condition, gpointer data)
{
@ -132,11 +132,11 @@ public:
void clear () {
Glib::Threads::Mutex::Lock lm (_lock);
for (boost::unordered_map<FileDescriptor, EventHandler>::const_iterator it = _event_handlers.begin (); it != _event_handlers.end (); ++it) {
for (std::unordered_map<FileDescriptor, EventHandler>::const_iterator it = _event_handlers.begin (); it != _event_handlers.end (); ++it) {
g_source_remove (it->second._source_id);
g_io_channel_unref (it->second._gio_channel);
}
for (boost::unordered_map<guint, Linux::ITimerHandler*>::const_iterator it = _timer_handlers.begin (); it != _timer_handlers.end (); ++it) {
for (std::unordered_map<guint, Linux::ITimerHandler*>::const_iterator it = _timer_handlers.begin (); it != _timer_handlers.end (); ++it) {
g_source_remove (it->first);
}
_event_handlers.clear ();
@ -165,7 +165,7 @@ public:
tresult rv = false;
Glib::Threads::Mutex::Lock lm (_lock);
for (boost::unordered_map<FileDescriptor, EventHandler>::const_iterator it = _event_handlers.begin (); it != _event_handlers.end ();) {
for (std::unordered_map<FileDescriptor, EventHandler>::const_iterator it = _event_handlers.begin (); it != _event_handlers.end ();) {
if (it->second._handler == handler) {
g_source_remove (it->second._source_id);
g_io_channel_unref (it->second._gio_channel);
@ -198,7 +198,7 @@ public:
tresult rv = false;
Glib::Threads::Mutex::Lock lm (_lock);
for (boost::unordered_map<guint, Linux::ITimerHandler*>::const_iterator it = _timer_handlers.begin (); it != _timer_handlers.end ();) {
for (std::unordered_map<guint, Linux::ITimerHandler*>::const_iterator it = _timer_handlers.begin (); it != _timer_handlers.end ();) {
if (it->second == handler) {
g_source_remove (it->first);
it = _timer_handlers.erase (it);

View File

@ -1,7 +1,6 @@
#ifndef AUDIOGRAPHER_PROCESS_CONTEXT_H
#define AUDIOGRAPHER_PROCESS_CONTEXT_H
#include <boost/static_assert.hpp>
#include <boost/format.hpp>
#include "audiographer/visibility.h"
@ -28,7 +27,7 @@ class /*LIBAUDIOGRAPHER_API*/ ProcessContext
// This will need to be modified if if it's modified above
static const ThrowLevel throwLevel = DEFAULT_THROW_LEVEL;
BOOST_STATIC_ASSERT (std::is_trivially_destructible<T>::value);
static_assert (std::is_trivially_destructible<T>::value);
public:

View File

@ -1,7 +1,6 @@
#ifndef AUDIOGRAPHER_TYPE_UTILS_H
#define AUDIOGRAPHER_TYPE_UTILS_H
#include <boost/static_assert.hpp>
#include <memory>
#include <algorithm>
#include <cstring>
@ -30,7 +29,7 @@ class LIBAUDIOGRAPHER_API TypeUtilsBase
template<typename T = DefaultSampleType>
class /*LIBAUDIOGRAPHER_API*/ TypeUtils : private TypeUtilsBase
{
BOOST_STATIC_ASSERT (std::is_trivially_destructible<T>::value);
static_assert (std::is_trivially_destructible<T>::value);
typedef std::bool_constant<std::is_floating_point<T>::value ||
std::is_signed<T>::value> zero_fillable;

View File

@ -24,7 +24,6 @@
#include <glibmm.h>
#include <boost/foreach.hpp>
#include <boost/tokenizer.hpp>
#include "alsa_audiobackend.h"
@ -1002,7 +1001,7 @@ AlsaAudioBackend::_start (bool for_latency_measurement)
boost::tokenizer<boost::char_separator<char> > devs (ext, sep);
BOOST_FOREACH (const std::string& tmp, devs) {
for (const std::string& tmp : devs) {
std::string dev (tmp);
unsigned int sr = _samplerate;
unsigned int spp = _samples_per_period;

View File

@ -20,8 +20,7 @@
#define __push2_meter_h__
#include <map>
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_comparison.hpp>
#include <tuple>
#include <cairomm/pattern.h>
#include <cairomm/region.h>
@ -156,9 +155,9 @@ class Meter : public Item {
|| (dim == rhs.dim && stp == rhs.stp && cols < rhs.cols)
|| (dim == rhs.dim && stp == rhs.stp && cols == rhs.cols && style < rhs.style);
}
boost::tuple<int, int> dim;
boost::tuple<float, float, float, float> stp;
boost::tuple<int, int, int, int, int, int, int, int, int, int> cols;
std::tuple<int, int> dim;
std::tuple<float, float, float, float> stp;
std::tuple<int, int, int, int, int, int, int, int, int, int> cols;
int style;
};
typedef std::map<Pattern10MapKey, Cairo::RefPtr<Cairo::Pattern> > Pattern10Map;
@ -172,8 +171,8 @@ class Meter : public Item {
inline bool operator<(const PatternBgMapKey& rhs) const {
return (dim < rhs.dim) || (dim == rhs.dim && cols < rhs.cols) || (dim == rhs.dim && cols == rhs.cols && (sh && !rhs.sh));
}
boost::tuple<int, int> dim;
boost::tuple<int, int> cols;
std::tuple<int, int> dim;
std::tuple<int, int> cols;
bool sh;
};
typedef std::map<PatternBgMapKey, Cairo::RefPtr<Cairo::Pattern> > PatternBgMap;

View File

@ -27,7 +27,7 @@ ArrowTest::bounding_box ()
arrow.set_outline_width (0);
boost::optional<Rect> bbox = arrow.bounding_box ();
std::optional<Rect> bbox = arrow.bounding_box ();
CPPUNIT_ASSERT (bbox.is_initialized ());
CPPUNIT_ASSERT (bbox.value().x0 == -6);

View File

@ -23,7 +23,7 @@ GroupTest::bounding_box ()
c.set_outline_width (0);
Rectangle d (canvas.root(), Rect (33, 33, 64, 64));
d.set_outline_width (0);
boost::optional<Rect> bbox = canvas.root()->bounding_box ();
std::optional<Rect> bbox = canvas.root()->bounding_box ();
/* check the bounding box */
CPPUNIT_ASSERT (bbox.is_initialized ());
@ -51,7 +51,7 @@ GroupTest::null_bounding_box ()
Group empty (canvas.root());
boost::optional<Rect> bbox = empty.bounding_box ();
std::optional<Rect> bbox = empty.bounding_box ();
CPPUNIT_ASSERT (!bbox.is_initialized ());
}
@ -116,7 +116,7 @@ GroupTest::children_changing ()
a.set_outline_width (0);
/* Check that initial bbox */
boost::optional<Rect> bbox = canvas.root()->bounding_box ();
std::optional<Rect> bbox = canvas.root()->bounding_box ();
CPPUNIT_ASSERT (bbox.is_initialized ());
CPPUNIT_ASSERT (bbox.value().x0 == 0);
CPPUNIT_ASSERT (bbox.value().y0 == 0);
@ -156,7 +156,7 @@ GroupTest::grandchildren_changing ()
a.set_outline_width (0);
/* Check the initial bboxes */
boost::optional<Rect> bbox = canvas.root()->bounding_box ();
std::optional<Rect> bbox = canvas.root()->bounding_box ();
CPPUNIT_ASSERT (bbox.is_initialized ());
CPPUNIT_ASSERT (bbox.value().x0 == 0);
CPPUNIT_ASSERT (bbox.value().y0 == 0);
@ -276,7 +276,7 @@ GroupTest::torture_add_items_at_point ()
}
for (list<Item*>::iterator j = rectangles.begin(); j != rectangles.end(); ++j) {
boost::optional<Rect> bbox = (*j)->bounding_box ();
std::optional<Rect> bbox = (*j)->bounding_box ();
assert (bbox);
if (bbox.value().contains (test)) {
items_B.push_back (*j);

View File

@ -29,7 +29,7 @@ PolygonTest::bounding_box ()
/* should now have a bounding box around those points,
taking into account default line width
*/
boost::optional<Rect> bbox = polygon.bounding_box ();
std::optional<Rect> bbox = polygon.bounding_box ();
CPPUNIT_ASSERT (bbox.is_initialized ());
CPPUNIT_ASSERT (bbox.value().x0 == -6.25);
CPPUNIT_ASSERT (bbox.value().x1 == 6.25);

View File

@ -12,7 +12,7 @@ TypesTest::intersect ()
{
Rect a (0, 0, 1024, 1024);
Rect b (0, 0, 512, 512);
boost::optional<Rect> c = a.intersection (b);
std::optional<Rect> c = a.intersection (b);
CPPUNIT_ASSERT (c.is_initialized ());
CPPUNIT_ASSERT (c->x0 == 0);
@ -24,7 +24,7 @@ TypesTest::intersect ()
{
Rect a (0, 0, 512, 512);
Rect b (513, 513, 1024, 1024);
boost::optional<Rect> c = a.intersection (b);
std::optional<Rect> c = a.intersection (b);
CPPUNIT_ASSERT (!c.is_initialized ());
}

View File

@ -185,7 +185,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg)
true, just ignore this in terms of it being an error.
*/
boost::optional<bool> res = mtc_skipped ();
std::optional<bool> res = mtc_skipped ();
if (res.value_or (false)) {

View File

@ -325,7 +325,7 @@ void
Parser::scanner (unsigned char inbyte)
{
bool statusbit;
boost::optional<int> edit_result;
std::optional<int> edit_result;
// cerr << "parse: " << hex << (int) inbyte << dec << " state = " << state << " msgindex = " << msgindex << " runnable = " << runnable << endl;
@ -393,7 +393,7 @@ Parser::scanner (unsigned char inbyte)
}
if (rtmsg) {
boost::optional<int> res = edit (&inbyte, 1);
std::optional<int> res = edit (&inbyte, 1);
if (res.value_or (1) >= 0 && !_offline) {
realtime_msg (inbyte);
@ -430,7 +430,7 @@ Parser::scanner (unsigned char inbyte)
#endif
if (msgindex > 0) {
boost::optional<int> res = edit (msgbuf, msgindex);
std::optional<int> res = edit (msgbuf, msgindex);
if (res.value_or (1) >= 0) {
if (!possible_mmc (msgbuf, msgindex) || _mmc_forward) {

View File

@ -38,7 +38,7 @@
#include <boost/bind/protect.hpp>
#include <boost/function.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/optional.hpp>
#include <optional>
#include "pbd/libpbd_visibility.h"
#include "pbd/event_loop.h"
@ -87,7 +87,7 @@ template<typename R>
class /*LIBPBD_API*/ OptionalLastValue
{
public:
typedef boost::optional<R> result_type;
typedef std::optional<R> result_type;
template <typename Iter>
result_type operator() (Iter first, Iter last) const {

View File

@ -16,7 +16,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <boost/optional.hpp>
#include <optional>
#include "pbd/abstract_ui.cc" // instantiate template
#include "pbd/controllable.h"
@ -1112,7 +1112,7 @@ void
Console1::create_strip_inventory ()
{
DEBUG_TRACE (DEBUG::Console1, "create_strip_inventory()\n");
boost::optional<order_t> master_order;
std::optional<order_t> master_order;
strip_inventory.clear ();
StripableList sl = session->get_stripables ();
uint32_t index = 0;

View File

@ -19,7 +19,7 @@
#ifndef _ardour_surface_websockets_dispatcher_h_
#define _ardour_surface_websockets_dispatcher_h_
#include <boost/unordered_map.hpp>
#include <unordered_map>
#include "client.h"
#include "component.h"
@ -39,7 +39,7 @@ public:
private:
typedef void (WebsocketsDispatcher::*DispatcherMethod) (Client, const NodeStateMessage&);
typedef boost::unordered_map<std::string, DispatcherMethod> NodeMethodMap;
typedef std::unordered_map<std::string, DispatcherMethod> NodeMethodMap;
static NodeMethodMap _node_to_method;

View File

@ -19,7 +19,7 @@
#ifndef _ardour_surface_websockets_server_h_
#define _ardour_surface_websockets_server_h_
#include <boost/unordered_map.hpp>
#include <unordered_map>
#include <glibmm.h>
#include <libwebsockets.h>
@ -63,7 +63,7 @@ private:
struct lws_context_creation_info _lws_info;
struct lws_context* _lws_context;
typedef boost::unordered_map<Client, ClientContext> ClientContextMap;
typedef std::unordered_map<Client, ClientContext> ClientContextMap;
ClientContextMap _client_ctx;
ServerResources _resources;
@ -90,7 +90,7 @@ private:
Glib::RefPtr<Glib::IOChannel> _channel;
typedef boost::unordered_map<lws_sockfd_type, LwsPollFdGlibSource> LwsPollFdGlibSourceMap;
typedef std::unordered_map<lws_sockfd_type, LwsPollFdGlibSource> LwsPollFdGlibSourceMap;
LwsPollFdGlibSourceMap _fd_ctx;
bool _fd_callbacks;

View File

@ -21,8 +21,7 @@
#define _WIDGETS_FAST_METER_H_
#include <map>
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_comparison.hpp>
#include <tuple>
#include <cairomm/pattern.h>
#include "gtkmm2ext/cairo_widget.h"
@ -143,9 +142,9 @@ private:
|| (dim == rhs.dim && stp == rhs.stp && cols < rhs.cols)
|| (dim == rhs.dim && stp == rhs.stp && cols == rhs.cols && style < rhs.style);
}
boost::tuple<int, int> dim;
boost::tuple<float, float, float, float> stp;
boost::tuple<int, int, int, int, int, int, int, int, int, int> cols;
std::tuple<int, int> dim;
std::tuple<float, float, float, float> stp;
std::tuple<int, int, int, int, int, int, int, int, int, int> cols;
int style;
};
typedef std::map<Pattern10MapKey, Cairo::RefPtr<Cairo::Pattern> > Pattern10Map;
@ -159,8 +158,8 @@ private:
inline bool operator<(const PatternBgMapKey& rhs) const {
return (dim < rhs.dim) || (dim == rhs.dim && cols < rhs.cols) || (dim == rhs.dim && cols == rhs.cols && (sh && !rhs.sh));
}
boost::tuple<int, int> dim;
boost::tuple<int, int> cols;
std::tuple<int, int> dim;
std::tuple<int, int> cols;
bool sh;
};
typedef std::map<PatternBgMapKey, Cairo::RefPtr<Cairo::Pattern> > PatternBgMap;

View File

@ -19,7 +19,7 @@
#ifndef _WIDGETS_FRAME_H_
#define _WIDGETS_FRAME_H_
#include <boost/optional.hpp>
#include <optional>
#include <gtkmm/bin.h>
#include "gtkmm2ext/colors.h"
@ -65,7 +65,7 @@ private:
sigc::connection _parent_style_change;
Glib::RefPtr<Pango::Layout> _layout;
std::string _label_text;
boost::optional<Gdk::Color> _edge_color;
std::optional<Gdk::Color> _edge_color;
GtkRequisition _min_size;
int _border;