diff options
Diffstat (limited to 'staptree.cxx')
-rw-r--r-- | staptree.cxx | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/staptree.cxx b/staptree.cxx index fdfc516c..1656f64a 100644 --- a/staptree.cxx +++ b/staptree.cxx @@ -9,6 +9,8 @@ #include "config.h" #include "staptree.h" #include "parse.h" +#include "util.h" + #include <iostream> #include <typeinfo> #include <sstream> @@ -17,37 +19,6 @@ using namespace std; -// return as quoted string, with at least '"' backslash-escaped -template <typename IN> inline string -lex_cast_qstring(IN const & in) -{ - stringstream ss; - string out, out2; - if (!(ss << in)) - throw runtime_error("bad lexical cast"); - out = ss.str(); - out2 += '"'; - for (unsigned i=0; i<out.length(); i++) - { - if (out[i] == '"') // XXX others? - out2 += '\\'; - out2 += out[i]; - } - out2 += '"'; - return out2; -} - - -template <typename OUT, typename IN> inline OUT -lex_cast(IN const & in) -{ - stringstream ss; - OUT out; - if (!(ss << in && ss >> out)) - throw runtime_error("bad lexical cast"); - return out; -} - expression::expression (): type (pe_unknown), tok (0) |