kakinoki.h
Go to the documentation of this file.
00001 /* kakinoki.h
00002  */
00003 #ifndef OSL_KAKINOKI_H
00004 #define OSL_KAKINOKI_H
00005 
00006 #include "osl/record/record.h"
00007 #include "osl/state/numEffectState.h"
00008 #include <boost/shared_ptr.hpp>
00009 #include <string>
00010 #include <iosfwd>
00011 #include <stdexcept>
00012 
00013 namespace osl
00014 {
00015   namespace record
00016   {
00017     namespace kakinoki
00018     {
00019       Move strToMove(const std::string&, const SimpleState&, 
00020                      Move last_move=Move());
00021       std::pair<Player,Ptype> strToPiece(const std::string&);
00022 
00023       class InputStream : public IRecordStream
00024       {
00025       private:
00026         std::istream& is;
00027         SimpleState state;
00028         boost::shared_ptr<RecordVisitor> rv;
00029       public:
00030         InputStream(std::istream& is);
00031         InputStream(std::istream& is, boost::shared_ptr<RecordVisitor> rv);
00032         virtual ~InputStream();
00033 
00034         virtual void load(Record*);
00035         const SimpleState& getState() const { return state;}
00036       };
00037 
00038       class KakinokiFile
00039       {
00040       private:
00041         Record rec;
00042       public:
00043         KakinokiFile(const std::string& filename);
00044         ~KakinokiFile();
00045 
00046         Record const& getRecord() const;
00047         const NumEffectState getInitialState() const;
00048 
00049         static bool isKakinokiFile(const std::string& filename);
00050       };
00051 
00052       struct KakinokiIOError : public std::runtime_error
00053       {
00054         KakinokiIOError(const std::string& w) : std::runtime_error(w)
00055         {
00056         }
00057       };
00058     } // namespace kakinoki
00059   }
00060   using record::kakinoki::KakinokiFile;
00061   using record::kakinoki::KakinokiIOError;
00062 }
00063 
00064 #endif /* OSL_KAKINOKI_H */
00065 // ;;; Local Variables:
00066 // ;;; mode:c++
00067 // ;;; c-basic-offset:2
00068 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines