From 72dbc9153036800cefdb5f2970666acc82cdb732 Mon Sep 17 00:00:00 2001 From: fche Date: Wed, 8 Nov 2006 17:51:32 +0000 Subject: 2006-11-08 Frank Ch. Eigler * util.h (lex_cast_qstring): Move def'n here. Also quote \. (stringify, lex_cast, lex_cast_hex): Move defn here. * buildrun.cxx, elaborate.cxx, main.cxx, staptree.cxx: Adapt. --- tapsets.cxx | 45 +-------------------------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 3de3e5bd..9d0b7ebc 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -13,6 +13,7 @@ #include "tapsets.h" #include "translate.h" #include "session.h" +#include "util.h" #include #include @@ -50,50 +51,6 @@ extern "C" { using namespace std; -// XXX: should standardize to these functions throughout translator - -template inline OUT -lex_cast(IN const & in) -{ - stringstream ss; - OUT out; - if (!(ss << in && ss >> out)) - throw runtime_error("bad lexical cast"); - return out; -} - -template inline OUT -lex_cast_hex(IN const & in) -{ - stringstream ss; - OUT out; - if (!(ss << hex << showbase << in && ss >> out)) - throw runtime_error("bad lexical cast"); - return out; -} - - -// return as quoted string, with at least '"' backslash-escaped -template 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