All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
usi.h
Go to the documentation of this file.
1 /* usi.h
2  */
3 #ifndef OSL_USI_H
4 #define OSL_USI_H
5 
6 #include "osl/record/record.h"
7 #include "osl/move.h"
8 #include "osl/stl/vector.h"
9 #include <string>
10 #include <stdexcept>
11 
12 namespace osl
13 {
14  namespace state
15  {
16  class SimpleState;
17  class NumEffectState;
18  }
19  namespace record
20  {
21  namespace usi
22  {
23  const Move strToMove(const std::string&, const state::SimpleState&);
24  PtypeO charToPtypeO(char);
25 
26  const std::string show(Move);
27  const std::string show(PtypeO);
28  const std::string show(Piece);
29  const std::string show(const state::SimpleState&);
30 
31  class ParseError : public std::invalid_argument
32  {
33  public:
34  ParseError(const std::string& msg = "")
35  : invalid_argument(msg)
36  { }
37  };
38 
45  void parseBoard(const std::string& board, state::SimpleState&);
47  void parse(const std::string& line, state::NumEffectState&);
48  void parse(const std::string& line, state::SimpleState& initial, vector<Move>& moves);
49 
50  state::NumEffectState makeState(const std::string& line);
56  void escape(std::string& str);
62  void unescape(std::string& str);
63 
64  class UsiFile
65  {
66  private:
68  public:
69  UsiFile(const std::string& filename);
70  ~UsiFile();
71 
72  Record const& getRecord() const;
73  const NumEffectState getInitialState() const;
74  };
75  }
76  } // record
78 } // osl
79 
80 #endif /* OSL_USI_H */
81 // ;;; Local Variables:
82 // ;;; mode:c++
83 // ;;; c-basic-offset:2
84 // ;;; End: