00001 /* usi.h 00002 */ 00003 #ifndef OSL_USI_H 00004 #define OSL_USI_H 00005 00006 #include "osl/record/record.h" 00007 #include "osl/move.h" 00008 #include "osl/stl/vector.h" 00009 #include <string> 00010 #include <stdexcept> 00011 00012 namespace osl 00013 { 00014 namespace state 00015 { 00016 class SimpleState; 00017 class NumEffectState; 00018 } 00019 namespace record 00020 { 00021 namespace usi 00022 { 00023 const Move strToMove(const std::string&, const state::SimpleState&); 00024 PtypeO charToPtypeO(char); 00025 00026 const std::string show(Move); 00027 const std::string show(PtypeO); 00028 const std::string show(Piece); 00029 const std::string show(const state::SimpleState&); 00030 00031 class ParseError : public std::invalid_argument 00032 { 00033 public: 00034 ParseError(const std::string& msg = "") 00035 : invalid_argument(msg) 00036 { } 00037 }; 00038 00045 void parseBoard(const std::string& board, state::SimpleState&); 00047 void parse(const std::string& line, state::NumEffectState&); 00048 void parse(const std::string& line, state::SimpleState& initial, vector<Move>& moves); 00049 00055 void escape(std::string& str); 00061 void unescape(std::string& str); 00062 00063 class UsiFile 00064 { 00065 private: 00066 Record record; 00067 public: 00068 UsiFile(const std::string& filename); 00069 ~UsiFile(); 00070 00071 Record const& getRecord() const; 00072 const NumEffectState getInitialState() const; 00073 }; 00074 } 00075 } // record 00076 using record::usi::UsiFile; 00077 } // osl 00078 00079 #endif /* OSL_USI_H */ 00080 // ;;; Local Variables: 00081 // ;;; mode:c++ 00082 // ;;; c-basic-offset:2 00083 // ;;; End: