summaryrefslogtreecommitdiffstats
path: root/src/PluginAlgorithm.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <wjp@usecode.org>2016-01-18 17:47:53 +0100
committerWillem Jan Palenstijn <wjp@usecode.org>2016-01-18 17:47:53 +0100
commit530aa4f96e9d0fe40ccd0bb9ae1363792a49467c (patch)
tree41ea934e76ad38f221a38469c6add9152f3a0884 /src/PluginAlgorithm.cpp
parent34bab2b0caa6ee955d5d2f7882a6cd36cf142536 (diff)
parentfc86917da1a175c04e9bd2e5f0bedb0a48a81c26 (diff)
downloadastra-530aa4f96e9d0fe40ccd0bb9ae1363792a49467c.tar.gz
astra-530aa4f96e9d0fe40ccd0bb9ae1363792a49467c.tar.bz2
astra-530aa4f96e9d0fe40ccd0bb9ae1363792a49467c.tar.xz
astra-530aa4f96e9d0fe40ccd0bb9ae1363792a49467c.zip
Merge pull request #105 from wjp/strings
Replace boost::lexical_cast by stringstreams
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);
}
}