aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc/nocscript/expression.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/rfnoc/nocscript/expression.cpp')
-rw-r--r--host/lib/rfnoc/nocscript/expression.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/host/lib/rfnoc/nocscript/expression.cpp b/host/lib/rfnoc/nocscript/expression.cpp
index 38d6e2128..4f7d98108 100644
--- a/host/lib/rfnoc/nocscript/expression.cpp
+++ b/host/lib/rfnoc/nocscript/expression.cpp
@@ -18,7 +18,6 @@
#include "expression.hpp"
#include "function_table.hpp"
#include <uhd/utils/cast.hpp>
-#include <boost/foreach.hpp>
#include <boost/format.hpp>
#include <boost/assign.hpp>
#include <boost/algorithm/string.hpp>
@@ -55,12 +54,12 @@ expression_literal::expression_literal(
if (_val.substr(0, 2) == "0x") {
_int_val = uhd::cast::hexstr_cast<int>(_val);
} else {
- _int_val = boost::lexical_cast<int>(_val);
+ _int_val = std::stoi(_val);
}
break;
case expression::TYPE_DOUBLE:
- _double_val = boost::lexical_cast<double>(_val);
+ _double_val = std::stod(_val);
break;
case expression::TYPE_BOOL:
@@ -68,7 +67,7 @@ expression_literal::expression_literal(
_bool_val = true;
} else {
// lexical cast to bool is too picky
- _bool_val = bool(boost::lexical_cast<int>(_val));
+ _bool_val = bool(std::stoi(_val));
}
break;
@@ -77,8 +76,8 @@ expression_literal::expression_literal(
std::string str_vec = _val.substr(1, _val.size()-2);
std::vector<std::string> subtoken_list;
boost::split(subtoken_list, str_vec, boost::is_any_of(", "), boost::token_compress_on);
- BOOST_FOREACH(const std::string &t, subtoken_list) {
- _int_vector_val.push_back(boost::lexical_cast<int>(t));
+ for(const std::string &t: subtoken_list) {
+ _int_vector_val.push_back(std::stoi(t));
}
break;
}
@@ -143,11 +142,11 @@ bool expression_literal::to_bool() const
{
switch (_type) {
case TYPE_INT:
- return bool(boost::lexical_cast<int>(_val));
+ return bool(std::stoi(_val));
case TYPE_STRING:
return not _val.empty();
case TYPE_DOUBLE:
- return bool(boost::lexical_cast<double>(_val));
+ return bool(std::stod(_val));
case TYPE_BOOL:
return _bool_val;
case TYPE_INT_VECTOR:
@@ -206,11 +205,11 @@ std::string expression_literal::repr() const
{
switch (_type) {
case TYPE_INT:
- return boost::lexical_cast<std::string>(_int_val);
+ return std::to_string(_int_val);
case TYPE_STRING:
return _val;
case TYPE_DOUBLE:
- return boost::lexical_cast<std::string>(_double_val);
+ return std::to_string(_double_val);
case TYPE_BOOL:
return _bool_val ? "TRUE" : "FALSE";
case TYPE_INT_VECTOR:
@@ -299,7 +298,7 @@ expression_literal expression_container::eval()
}
expression_literal ret_val;
- BOOST_FOREACH(const expression::sptr &sub_expr, _sub_exprs) {
+ for(const expression::sptr &sub_expr: _sub_exprs) {
ret_val = sub_expr->eval();
if (_combiner == COMBINE_AND and ret_val.to_bool() == false) {
return ret_val;
@@ -319,7 +318,7 @@ std::string expression_function::to_string(const std::string &name, const argtyp
{
std::string s = name;
int arg_count = 0;
- BOOST_FOREACH(const expression::type_t type, types) {
+ for(const expression::type_t type: types) {
if (arg_count == 0) {
s += "(";
} else {