From 60144c3e2fc6e36a9a1a6ebefbbebe41adc79c2c Mon Sep 17 00:00:00 2001 From: Thomas Habets <thomas@habets.se> Date: Fri, 3 Apr 2020 15:47:53 +0100 Subject: qtgui: Remove boost::lexical_cast for parsing This is the last boost::lexical_cast in gnuradio. --- gr-qtgui/lib/edit_box_msg_impl.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'gr-qtgui/lib/edit_box_msg_impl.cc') 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(","); -- cgit v1.2.3