00001 #ifndef PIECE_HPP 00002 #define PIECE_HPP 00003 00004 #include <string> 00005 #include <map> 00006 00007 class Piece 00008 { 00009 private: 00010 bool m_valid; 00012 int m_color; 00013 int m_type; 00015 typedef std::map<std::string, int> PropertyMap; 00016 PropertyMap m_properties; 00017 00018 public: 00021 Piece():m_valid(false) {} 00022 00027 Piece(int owner, int type); 00028 00032 bool isValid()const { return m_valid; } 00033 00038 void setProperty(const std::string & name, int value); 00039 00043 bool hasProperty(const std::string& name)const; 00044 00048 int getProperty(const std::string& name)const; 00049 00052 int color()const { return m_color; } 00053 00056 int type()const { return m_type; } 00057 }; 00058 00068 namespace SPiece 00069 { 00070 static const Piece InvalidPiece = Piece(); 00071 } 00072 00073 #endif