Skip to content
Snippets Groups Projects
functions.cc 533 B
Newer Older
David Flitney's avatar
David Flitney committed
#include "options.h"

David Flitney's avatar
David Flitney committed
// $Id$

David Flitney's avatar
David Flitney committed
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());
  }

David Flitney's avatar
David Flitney committed
  ostream& operator<<(ostream &os, const BaseOption& o) {
    return os << 
      "\t" << o.key() << 
      "\t" << o.help_text();
  }

David Flitney's avatar
David Flitney committed
}