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 } 00018 namespace record 00019 { 00020 namespace usi 00021 { 00022 const Move strToMove(const std::string&, const state::SimpleState&); 00023 PtypeO charToPtypeO(char); 00024 00025 const std::string show(Move); 00026 const std::string show(PtypeO); 00027 const std::string show(Piece); 00028 const std::string show(const state::SimpleState&); 00029 00030 class ParseError : public std::invalid_argument 00031 { 00032 public: 00033 ParseError(const std::string& msg = "") 00034 : invalid_argument(msg) 00035 { } 00036 }; 00037 00044 void parseBoard(const std::string& board, state::SimpleState&); 00046 void parse(const std::string& line, state::SimpleState&); 00047 void parse(const std::string& line, state::SimpleState& initial, vector<Move>& moves); 00048 00054 void escape(std::string& str); 00060 void unescape(std::string& str); 00061 00062 class UsiFile 00063 { 00064 private: 00065 Record record; 00066 public: 00067 UsiFile(const std::string& filename); 00068 ~UsiFile(); 00069 00070 Record const& getRecord() const; 00071 const NumEffectState getInitialState() const; 00072 }; 00073 } 00074 } // record 00075 using record::usi::UsiFile; 00076 } // osl 00077 00078 #endif /* OSL_USI_H */ 00079 // ;;; Local Variables: 00080 // ;;; mode:c++ 00081 // ;;; c-basic-offset:2 00082 // ;;; End: