src/DB/Savables/Character.h

00001 /***************************************************************************
00002  *   Copyright (C) 2008 by Sverre Rabbelier                                *
00003  *   sverre@rabbelier.nl                                                   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 3 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #pragma once
00021 
00022 #include "SavableHeaders.h"
00023 #include "SavableTypes.h"
00024 
00025 namespace mud
00026 {
00027         class CharacterManager;
00028         
00029         class Character : public Savable
00030         {
00031         public:
00032                 virtual void OnSend(const std::string& msg);
00033                 virtual void OnSendf(const char* format, ...);
00034                 
00035                 /*
00036                  * Start of Commands
00037                  */     
00038                 virtual void OnAreaList(const std::string& msg);
00039                 virtual void OnColourList(const std::string& msg);
00040                 virtual void OnLook(const std::string& msg);
00041                 virtual void OnRaceList(const std::string& msg);
00042                 virtual void OnRoomList(const std::string& msg);
00043                 virtual void OnScore(const std::string& msg);
00044                 virtual void OnSay(const std::string& msg);
00045                 /*
00046                  * End of commands
00047                  */ 
00048          
00049                 /*
00050                  * Getters
00051                  */ 
00052                 value_type getID() const;
00053                 const std::string& getName() const;
00054                 const std::string& getDescription() const;
00055                 value_type getRace() const;
00056                 value_type getRoom() const;
00057 
00058                 /*
00059                  * Setters
00060                  */ 
00061                 void setName(const std::string& name);
00062                 void setDescription(const std::string& description);
00063                 void setRace(value_type race);
00064                 void setRoom(value_type room);
00065                 
00066                 /*
00067                  * Operations
00068                  */ 
00069                 void MoveToRoom(value_type room);
00070                 
00071                 /*
00072                  * Database operations
00073                  */
00074                 void Delete();
00075                 void Save();
00076                 void Discard();
00077                 bool Exists();  
00078                 
00079                 /*
00080                  * Utilities
00081                  */
00082                 SavableManagerPtr getManager() const;
00083                 TableImplPtr getTable() const;
00084 
00085         protected:
00086                 SavableManagerPtr m_character; 
00088                 Character(SavableManagerPtr character);
00089                 virtual ~Character(void);
00090                 
00091                 friend class mud::CharacterManager; // for constructor
00092                 friend SmartPtrDelete(mud::Character);
00093                 
00094         private:
00095                 Character(const Character& rhs);
00096                 Character operator=(const Character& rhs);
00097         };
00098 }

Generated for UnsignedByte by  doxygen 1.5.3
SourceForge.net Logo