src/Core/Editors/EditorChunk.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 "Types.h"
00023 #include "SavableTypes.h"
00024 
00025 #include "OLCEditor.h"
00026 #include "CommandInfoObject.h"
00027 #include "CommandTable.h"
00028 
00029 class ChunkImporter;
00030 typedef SmartPtr<ChunkImporter> ChunkImporterPtr;
00031 
00032 class EditorChunk : public OLCEditor
00033 {
00034 public:
00035         typedef CommandInfoObject<EditorChunk> ChunkCommand; 
00037         EditorChunk(UBSocket* sock);
00038         EditorChunk(UBSocket* sock, mud::RoomPtr parentRoom);
00039         ~EditorChunk(void);
00040         
00041         void OnFocus();
00042 
00043         std::string name() { return "Chunk"; };
00044         std::string prompt() { return "Chunk> "; };
00045         
00046         std::string lookup(const std::string& action);
00047         void dispatch(const std::string& action, const std::string& argument);
00048         
00049         SavablePtr getEditing();
00050         TableImplPtr getTable();
00051         KeysPtr addNew();
00052         std::vector<std::string> getList();
00053         std::vector<std::string> getCommands();
00054         void setEditing(KeysPtr keys);
00055         
00056         void editName(const std::string& argument);
00057         void editDescription(const std::string& argument);
00058         void editTags(const std::string& argument);
00059         void editRoom(const std::string& argument);
00060         void startDetails(const std::string& argument);
00061         void importChunk(const std::string& argument);
00062         void showChunk(const std::string& argument);
00063         void saveChunk(const std::string& argument);
00064         void clearParentRoom(const std::string& argument);
00065         void setParentRoom(const std::string& argument);
00066 
00067 private:
00068         enum E_TARGET
00069         {
00070                 M_NONE,
00071                 M_IMPORT,
00072                 M_IMPORTACCEPT,
00073                 M_IMPORTSAVECHUNK,
00074         };
00075         
00076         CommandTable<EditorChunk> m_commands;
00077         mud::ChunkPtr m_chunk;
00078         mud::RoomPtr m_parentRoom;
00079         
00080         std::string m_value;
00081         bool m_yesno;
00082         EditorChunk::E_TARGET m_target;
00083         ChunkImporterPtr m_importer;
00084         
00085         EditorChunk(const EditorChunk& rhs);
00086         EditorChunk operator=(const EditorChunk& rhs);
00087 };

Generated for UnsignedByte by  doxygen 1.5.3
SourceForge.net Logo