00001 //---------------------------------------------------------------------------- 00002 /** @file GoSetupUtil.h 00003 utilities to create setup information for GoBoard. 00004 */ 00005 //---------------------------------------------------------------------------- 00006 00007 #ifndef GO_SETUPUTIL_H 00008 #define GO_SETUPUTIL_H 00009 00010 #include <streambuf> 00011 #include "GoBoard.h" 00012 #include "GoSetup.h" 00013 00014 //---------------------------------------------------------------------------- 00015 namespace GoSetupUtil 00016 { 00017 00018 /** Create a setup instance from text stream. 00019 Recognizes '0','o','O' for white stones, 00020 'x', 'X', '@' for black stones, 00021 '.' and '+' for empty points. 00022 Blanks ' ' and tabs are ignored. 00023 Lines must be separated by a '\n' character. 00024 */ 00025 GoSetup CreateSetupFromStream(std::streambuf& in, int& boardSize); 00026 00027 GoSetup CreateSetupFromString(std::string& in, int& boardSize); 00028 00029 /** Get a setup instance with the current position on board. */ 00030 GoSetup CurrentPosSetup(const GoBoard& bd); 00031 00032 } // namespace GoSetupUtil 00033 00034 //---------------------------------------------------------------------------- 00035 00036 #endif // GO_SETUPUTIL_H 00037