Nicolas Winkler 7 سال پیش
والد
کامیت
a4261dd921
2فایلهای تغییر یافته به همراه13 افزوده شده و 8 حذف شده
  1. 4 5
      src/UciParser.cpp
  2. 9 3
      src/UciParser.h

+ 4 - 5
src/UciParser.cpp

@@ -56,6 +56,7 @@ int UciParser::executeCommand(const string& command,
     }
 }
 
+
 void UciParser::sendCommand(const std::string& command,
     const std::vector<std::string>& args)
 {
@@ -67,7 +68,7 @@ void UciParser::sendCommand(const std::string& command,
 
 void UciParser::uci(const std::vector<std::string>& args)
 {
-    sendCommand(UCIOK);
+    sendCommand("uciok");
 }
 
 
@@ -85,11 +86,9 @@ void UciParser::isready(const std::vector<std::string>& args)
 
 void UciParser::setoption(const std::vector<std::string>& args)
 {
-    if (args.size() < 2)
-        return;
-    if (args[0] != "name")
-        return;
+    Option o;
     
+    optionsManager.setOption();
 }
 
 

+ 9 - 3
src/UciParser.h

@@ -13,15 +13,20 @@ struct Option
     std::string name;
     std::string type;
     std::string defaultValue;
-    std::string min;
-    std::string max;
+    int min;
+    int max;
 };
 
 
 class OptionsManager
 {
+    std::map<std::string, Option> options = {
+        {"", {}}
+    };
 public:
-    OptionsManager(void);
+    OptionsManager(void) = default;
+
+    void setOption(const std::string& name, const Option& option);
 };
 
 
@@ -50,6 +55,7 @@ public:
     virtual void sendCommand(const std::string& command,
         const std::vector<std::string>& args = {});
 
+    // command handlers
     virtual void uci            (const std::vector<std::string>& args);
     virtual void debug          (const std::vector<std::string>& args);
     virtual void isready        (const std::vector<std::string>& args);