From fad772f38753ef3f0ac745ace5f339073a6517b6 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sat, 11 Apr 2009 14:04:33 +0200 Subject: [PATCH] Store UCI options of type CHECK according to C++ convention Store boolean values as "1" and "0" instead of "true" and "false" and convert back to UCI protocol convention when needed. This is simpler then the other way around. Signed-off-by: Marco Costalba --- src/ucioption.cpp | 59 ++++++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/src/ucioption.cpp b/src/ucioption.cpp index 49e8f228..c31a49e7 100644 --- a/src/ucioption.cpp +++ b/src/ucioption.cpp @@ -167,13 +167,6 @@ namespace { return ss.str(); } - // We want conversion from a bool value to be "true" or "false", - // not "1" or "0", so add a specialization for bool type. - template<> - std::string stringify(const bool& v) { - - return v ? "true" : "false"; - } // get_option_value implements the various get_option_value_ // functions defined later, because only the option value @@ -191,19 +184,6 @@ namespace { return ret; } - // Unfortunatly we need a specialization to convert "false" and "true" - // to proper bool values. The culprit is that we use a non standard way - // to store a bool value in a string, in particular we use "false" and - // "true" instead of "0" and "1" due to how UCI protocol works. - - template<> - bool get_option_value(const std::string& optionName) { - - if (options.find(optionName) == options.end()) - return false; - - return options[optionName].currentValue == "true"; - } } //// @@ -258,24 +238,27 @@ void print_uci_options() { for (std::vector