#include "options.h" // $Id$ namespace Utilities { bool string_to_T(bool &b, const string& s) { if(s.length() == 0) { b = !b; return true; } else if (s == "true") { b = true; return true; } else if (s == "false") { b = false; return true; } else return false; } bool string_to_T(string& d, const string& s) { d = s; return true; } bool string_to_T(int& i, const string& s) { char *endptr = 0; const char *str = s.c_str(); i = strtol(str, &endptr, 0); if(*endptr == str[s.length()]) return true; else return false; } bool string_to_T(float& v, const string& s) { char *endptr = 0; const char *str = s.c_str(); v = strtod(str, &endptr); if(*endptr == str[s.length()]) return true; else return false; } ostream& operator<<(ostream &os, const BaseOption& o) { return os << "\t" << o.key() << "\t" << o.help_text(); } }