diff options
author | Thomas Habets <thomas@habets.se> | 2020-04-03 15:47:53 +0100 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2020-04-11 02:39:54 +0200 |
commit | 60144c3e2fc6e36a9a1a6ebefbbebe41adc79c2c (patch) | |
tree | cde54f4511fe427c643b6c5cf3662edcb4de28d8 /gr-qtgui/lib/edit_box_msg_impl.cc | |
parent | 3bab5f023ab406b9a4521e7c3be7fd4bd33135f7 (diff) |
qtgui: Remove boost::lexical_cast for parsing
This is the last boost::lexical_cast in gnuradio.
Diffstat (limited to 'gr-qtgui/lib/edit_box_msg_impl.cc')
-rw-r--r-- | gr-qtgui/lib/edit_box_msg_impl.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gr-qtgui/lib/edit_box_msg_impl.cc b/gr-qtgui/lib/edit_box_msg_impl.cc index ce2c740c78..7bb41b9a0c 100644 --- a/gr-qtgui/lib/edit_box_msg_impl.cc +++ b/gr-qtgui/lib/edit_box_msg_impl.cc @@ -17,8 +17,7 @@ #include <gnuradio/io_signature.h> #include <gnuradio/prefs.h> #include <gnuradio/qtgui/utils.h> - -#include <boost/lexical_cast.hpp> +#include <sstream> namespace gr { namespace qtgui { @@ -371,7 +370,7 @@ void edit_box_msg_impl::set_value(pmt::pmt_t val) void edit_box_msg_impl::edit_finished() { - QString text = d_val->text(); + const QString text = d_val->text(); bool conv_ok = true; int xi; float xf; @@ -455,16 +454,17 @@ void edit_box_msg_impl::edit_finished() } d_msg = pmt::init_f64vector(xv.size(), xv); } break; - case COMPLEX: - try { - xc = boost::lexical_cast<gr_complex>(text.toStdString()); - } catch (boost::bad_lexical_cast const& e) { + case COMPLEX: { + std::stringstream ss(text.toStdString()); + ss >> xc; + if (static_cast<size_t>(ss.tellg()) != ss.str().size()) { GR_LOG_WARN(d_logger, - boost::format("Conversion to complex failed (%1%)") % e.what()); + boost::format("Conversion of %s to complex failed") % + text.toStdString()); return; } d_msg = pmt::from_complex(xc.real(), xc.imag()); - break; + } break; case COMPLEX_VEC: { std::vector<gr_complex> xv; QStringList text_list = text.split(","); |