From bc85b911fcb05cf03c97c09ea58f0694e898f1d4 Mon Sep 17 00:00:00 2001 From: David Flitney <dave.flitney@ndcn.ox.ac.uk> Date: Thu, 23 Nov 2000 16:02:19 +0000 Subject: [PATCH] Initial revision --- functions.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 functions.cc diff --git a/functions.cc b/functions.cc new file mode 100644 index 0000000..f8d4d59 --- /dev/null +++ b/functions.cc @@ -0,0 +1,24 @@ +#include "options.h" + +namespace Utilities { + + void string_to_T(bool &b, const string& s) { + if(s == "NO ARG") + b = !b; + else + b = (s == "true"); + } + + void string_to_T(string& d, const string& s) { + d = s; + } + + void string_to_T(int& i, const string& s) { + i = atoi(s.c_str()); + } + + void string_to_T(float& v, const string& s) { + v = atof(s.c_str()); + } + +} -- GitLab