Use new boost::optional API
authorRobin Gareus <robin@gareus.org>
Thu, 21 Nov 2019 16:48:56 +0000 (17:48 +0100)
committerRobin Gareus <robin@gareus.org>
Thu, 21 Nov 2019 16:48:56 +0000 (17:48 +0100)
get_value_or() has been deprecated since boost 1.56

libs/ardour/file_source.cc
libs/ardour/io.cc
libs/ardour/route.cc
libs/ardour/session_state.cc
libs/ardour/tempo_map_importer.cc
libs/midi++2/mtc.cc
libs/midi++2/parser.cc

index 50d736046659a282d8975b2f712610b5370c1eb8..c5d9088ac5f6b6c227f5e9d4d13fc1a62a296af7 100644 (file)
@@ -296,7 +296,7 @@ FileSource::find (Session& s, DataType type, const string& path, bool must_exist
 
                        /* more than one match: ask the user */
 
-                        int which = FileSource::AmbiguousFileName (path, de_duped_hits).get_value_or (-1);
+                        int which = FileSource::AmbiguousFileName (path, de_duped_hits).value_or (-1);
 
                         if (which < 0) {
                                 goto out;
index f185e073b08fd6cb9df718d7bbcebd7c251788bf..b8e51ffd892159c3e8f1b167338f7d92b5e39a92 100644 (file)
@@ -231,7 +231,7 @@ IO::remove_port (boost::shared_ptr<Port> port, void* src)
        after.set (port->type(), after.get (port->type()) - 1);
 
        boost::optional<bool> const r = PortCountChanging (after); /* EMIT SIGNAL */
-       if (r.get_value_or (false)) {
+       if (r.value_or (false)) {
                return -1;
        }
 
@@ -1398,7 +1398,7 @@ IO::enable_connecting ()
        Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock());
        connecting_legal = true;
        boost::optional<int> r = ConnectingLegal ();
-       return r.get_value_or (0);
+       return r.value_or (0);
 }
 
 void
index 018035d4d32a07574f0b948574b9b09b894b27a0..b48b18b305f8fe33f3f72df40fa0d19c013ad161 100644 (file)
@@ -1076,7 +1076,7 @@ Route::add_processors (const ProcessorList& others, boost::shared_ptr<Processor>
 
                if (flags != None) {
                        boost::optional<int> rv = PluginSetup (boost::dynamic_pointer_cast<Route>(shared_from_this ()), pi, flags);  /* EMIT SIGNAL */
-                       int mode = rv.get_value_or (0);
+                       int mode = rv.value_or (0);
                        switch (mode & 3) {
                                case 1:
                                        to_skip.push_back (*i); // don't add this one;
index 51a057abf2d1aad4afce2e8170efd56f8a7f10d9..5222c85a8eb4128a09b3fc08411ff71bd92c8561 100644 (file)
@@ -961,7 +961,7 @@ Session::load_state (string snapshot_name)
                /* there is pending state from a crashed capture attempt */
 
                boost::optional<int> r = AskAboutPendingState();
-               if (r.get_value_or (1)) {
+               if (r.value_or (1)) {
                        state_was_pending = true;
                }
        }
@@ -1540,7 +1540,7 @@ Session::set_state (const XMLNode& node, int version)
                assert (AudioEngine::instance()->running ());
                if (_base_sample_rate != AudioEngine::instance()->sample_rate ()) {
                        boost::optional<int> r = AskAboutSampleRateMismatch (_base_sample_rate, _current_sample_rate);
-                       if (r.get_value_or (0)) {
+                       if (r.value_or (0)) {
                                goto out;
                        }
                }
@@ -2376,7 +2376,7 @@ retry:
                        }
 
                        if (!no_questions_about_missing_files) {
-                               user_choice = MissingFile (this, err.path, err.type).get_value_or (-1);
+                               user_choice = MissingFile (this, err.path, err.type).value_or (-1);
                        } else {
                                user_choice = -2;
                        }
@@ -3217,7 +3217,7 @@ int
 Session::ask_about_playlist_deletion (boost::shared_ptr<Playlist> p)
 {
        boost::optional<int> r = AskAboutPlaylistDeletion (p);
-       return r.get_value_or (1);
+       return r.value_or (1);
 }
 
 void
index cdb128df0e314357967f747802d69233be9bdda3..cbb0662aaa5c88803d58796f6374a0a9c54d5237 100644 (file)
@@ -87,7 +87,7 @@ 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?"));
-       return replace.get_value_or (false);
+       return replace.value_or (false);
 }
 
 void
index 79f9d27f85f709493f777aa6fb22203d8811102d..25d118372e385ec1ada440313487099869f8a007 100644 (file)
@@ -187,7 +187,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg)
 
                        boost::optional<bool> res = mtc_skipped ();
 
-                       if (res.get_value_or (false)) {
+                       if (res.value_or (false)) {
 
                                /* no error, reset next expected frame */
 
index 1b08eea8c1618023194adb1c1e8c010f82e90c52..0c3daf6b0b1d01b44157718fc03777cb99ddcdad 100644 (file)
@@ -390,7 +390,7 @@ Parser::scanner (unsigned char inbyte)
        if (rtmsg) {
                boost::optional<int> res = edit (&inbyte, 1);
 
-               if (res.get_value_or (1) >= 0 && !_offline) {
+               if (res.value_or (1) >= 0 && !_offline) {
                        realtime_msg (inbyte);
                }
 
@@ -427,7 +427,7 @@ Parser::scanner (unsigned char inbyte)
 
                        boost::optional<int> res = edit (msgbuf, msgindex);
 
-                       if (res.get_value_or (1) >= 0) {
+                       if (res.value_or (1) >= 0) {
                                if (!possible_mmc (msgbuf, msgindex) || _mmc_forward) {
                                        if (!possible_mtc (msgbuf, msgindex) || _mtc_forward) {
                                                if (!_offline) {
@@ -503,7 +503,7 @@ Parser::scanner (unsigned char inbyte)
 
                 edit_result = edit (msgbuf, msgindex);
 
-               if (edit_result.get_value_or (1)) {
+               if (edit_result.value_or (1)) {
 
                        /* message not cancelled by an editor */