From f0701e2b0f4283ba558e7d8cab8e41cf11a19cdd Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sat, 11 Apr 2009 12:46:47 +0200 Subject: [PATCH 1/1] Use a map instead of a vector to store UCI options Apart from the teoretical speed increase, the main reason of this patch is a good amount of code cleanup. Note that now UCI options are printed in alphabetical order and not in insertion order as before. Next patch will take care of restoring old behaviour. Signed-off-by: Marco Costalba --- src/ucioption.cpp | 270 +++++++++++++++++++++------------------------- 1 file changed, 125 insertions(+), 145 deletions(-) diff --git a/src/ucioption.cpp b/src/ucioption.cpp index 95e3e279..9e992be5 100644 --- a/src/ucioption.cpp +++ b/src/ucioption.cpp @@ -23,6 +23,7 @@ //// #include +#include #include #include #include @@ -55,91 +56,92 @@ namespace { struct Option { - std::string name, defaultValue, currentValue; + std::string defaultValue, currentValue; OptionType type; int minValue, maxValue; ComboValues comboValues; - Option(const char* name, const char* defaultValue, OptionType = STRING); - Option(const char* name, bool defaultValue, OptionType = CHECK); - Option(const char* name, int defaultValue, int minValue, int maxValue); + Option(); + Option(const std::string& defaultValue, OptionType = STRING); + Option(bool defaultValue, OptionType = CHECK); + Option(int defaultValue, int minValue, int maxValue); }; - typedef std::vector