summaryrefslogtreecommitdiffstats
path: root/src/PluginAlgorithm.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-12-17 14:37:41 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2016-01-05 11:15:17 +0100
commitfc86917da1a175c04e9bd2e5f0bedb0a48a81c26 (patch)
tree6996a3e2e2cfd110a566d4093e22ca746a52038d /src/PluginAlgorithm.cpp
parent73fa0a8df8203288aca032c71caa5ff47d35a3e2 (diff)
downloadastra-fc86917da1a175c04e9bd2e5f0bedb0a48a81c26.tar.gz
astra-fc86917da1a175c04e9bd2e5f0bedb0a48a81c26.tar.bz2
astra-fc86917da1a175c04e9bd2e5f0bedb0a48a81c26.tar.xz
astra-fc86917da1a175c04e9bd2e5f0bedb0a48a81c26.zip
Replace boost::lexical_cast by stringstreams
This is to avoid the dependence of lexical_cast on the current locale. The stringstreams used for the new string parsing/output functions are explicitly imbued with the C/classic locale.
Diffstat (limited to 'src/PluginAlgorithm.cpp')
-rw-r--r--src/PluginAlgorithm.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/PluginAlgorithm.cpp b/src/PluginAlgorithm.cpp
index 8f7dfc5..9fc511a 100644
--- a/src/PluginAlgorithm.cpp
+++ b/src/PluginAlgorithm.cpp
@@ -30,9 +30,9 @@ $Id$
#include "astra/PluginAlgorithm.h"
#include "astra/Logging.h"
+#include "astra/Utilities.h"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/split.hpp>
-#include <boost/lexical_cast.hpp>
#include <iostream>
#include <fstream>
#include <string>
@@ -338,7 +338,7 @@ PyObject* stringToPythonValue(std::string str){
boost::split(row, rows[i], boost::is_any_of(","));
PyObject *rowlist = PyList_New(row.size());
for(unsigned int j=0;j<row.size();j++){
- PyList_SetItem(rowlist, j, PyFloat_FromDouble(boost::lexical_cast<double>(row[j])));
+ PyList_SetItem(rowlist, j, PyFloat_FromDouble(StringUtil::stringToDouble(row[j])));
}
PyList_SetItem(mat, i, rowlist);
}
@@ -349,16 +349,16 @@ PyObject* stringToPythonValue(std::string str){
boost::split(vec, str, boost::is_any_of(","));
PyObject *veclist = PyList_New(vec.size());
for(unsigned int i=0;i<vec.size();i++){
- PyList_SetItem(veclist, i, PyFloat_FromDouble(boost::lexical_cast<double>(vec[i])));
+ PyList_SetItem(veclist, i, PyFloat_FromDouble(StringUtil::stringToDouble(vec[i])));
}
return veclist;
}
try{
- return PyLong_FromLong(boost::lexical_cast<long>(str));
- }catch(const boost::bad_lexical_cast &){
+ return PyLong_FromLong(StringUtil::stringToInt(str));
+ }catch(const StringUtil::bad_cast &){
try{
- return PyFloat_FromDouble(boost::lexical_cast<double>(str));
- }catch(const boost::bad_lexical_cast &){
+ return PyFloat_FromDouble(StringUtil::stringToDouble(str));
+ }catch(const StringUtil::bad_cast &){
return pyStringFromString(str);
}
}