src/DB/Savables/Room.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 Room : public Savable
00028         {
00029         public:
00030                 /*
00031                  * Getters
00032                  */ 
00033                 value_type getID() const;
00034                 const std::string& getName() const;
00035                 const std::string& getDescription() const;
00036                 value_type getSector() const;
00037                 value_type getCluster() const;
00038                 value_type getHeight() const;
00039                 value_type getWidth() const;
00040                 value_type getLength() const;
00041 
00042                 /*
00043                  * Setters
00044                  */ 
00045                 void setName(const std::string name);
00046                 void setDescription(const std::string description);
00047                 void setSector(value_type sector);
00048                 void setCluster(value_type cluster);
00049                 void setHeight(value_type height);
00050                 void setWidth(value_type width);
00051                 void setLength(value_type length);
00052                 
00053                 /*
00054                  * Room operations
00055                  */ 
00056                 void addCharacter(value_type characterid);
00057                 void removeCharacter(value_type characterid);
00058 
00060                 value_types::const_iterator firstCharactersInRoom() { return m_charactersInRoom.begin(); }
00061                 
00063                 value_types::const_iterator lastCharactersInRoom() { return m_charactersInRoom.end(); }
00064                 
00066                 value_type sizeCharactersInRoom() { return m_charactersInRoom.size(); }
00067 
00069                 void Send(const std::string& msg);
00070                 
00072                 void Sendf(const char* format, ...);
00073 
00074                 /*
00075                  * Utilities
00076                  */
00077                 SavableManagerPtr getManager() const;
00078                 TableImplPtr getTable() const;
00079                 
00080                 /*
00081                  * Database utilities
00082                  */
00083                 void Delete();
00084                 void Save();
00085                 void Delete(value_type accountid, const std::string& description);
00086                 void Save(value_type accountid, const std::string& description);
00087                 void Discard();
00088                 bool Exists();
00089 
00090         private:
00091                 SavableManagerPtr m_room;
00092                 value_types m_charactersInRoom;
00093 
00094                 Room(SavableManagerPtr room);
00095                 Room(const Room& rhs);
00096                 Room operator=(const Room& rhs);
00097                 ~Room(void);
00098 
00099                 friend class RoomManager; // constructor
00100                 friend SmartPtrDelete(mud::Room);
00101                 // friend class SmartPtr<mud::Room>;
00102         };
00103 }

Generated for UnsignedByte by  doxygen 1.5.3
SourceForge.net Logo