Chunk is purely a wrapper class, any 'state variables', like 'characters in room...
[UnsignedByte.git] / src / Core / Editors / EditorChunk.h
blobc2dfb9a72188a35153b27f0e2e4b4b6b56c18925
1 /***************************************************************************
2 * Copyright (C) 2008 by Sverre Rabbelier *
3 * sverre@rabbelier.nl *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20 #pragma once
22 #include "Types.h"
23 #include "SavableTypes.h"
25 #include "OLCEditor.h"
26 #include "CommandInfoObject.h"
27 #include "CommandTable.h"
29 class ChunkImporter;
30 typedef SmartPtr<ChunkImporter> ChunkImporterPtr;
32 class EditorChunk : public OLCEditor
34 public:
35 typedef CommandInfoObject<EditorChunk> ChunkCommand; /**< The type of a CommandInfoObject for this Editor. */
37 EditorChunk(UBSocket* sock);
38 EditorChunk(UBSocket* sock, mud::RoomPtr parentRoom);
39 ~EditorChunk(void);
41 void OnFocus();
43 std::string name() { return "Chunk"; };
44 std::string prompt() { return "Chunk> "; };
46 std::string lookup(const std::string& action);
47 void dispatch(const std::string& action, const std::string& argument);
49 SavablePtr getEditing();
50 TableImplPtr getTable();
51 KeysPtr addNew();
52 std::vector<std::string> getList();
53 std::vector<std::string> getCommands();
54 void setEditing(KeysPtr keys);
56 void editName(const std::string& argument);
57 void editDescription(const std::string& argument);
58 void editTags(const std::string& argument);
59 void editRoom(const std::string& argument);
60 void startDetails(const std::string& argument);
61 void importChunk(const std::string& argument);
62 void showChunk(const std::string& argument);
63 void saveChunk(const std::string& argument);
64 void clearParentRoom(const std::string& argument);
65 void setParentRoom(const std::string& argument);
67 private:
68 enum E_TARGET
70 M_NONE,
71 M_IMPORT,
72 M_IMPORTACCEPT,
73 M_IMPORTSAVECHUNK,
76 CommandTable<EditorChunk> m_commands;
77 mud::ChunkPtr m_chunk;
78 mud::RoomPtr m_parentRoom;
80 std::string m_value;
81 bool m_yesno;
82 EditorChunk::E_TARGET m_target;
83 ChunkImporterPtr m_importer;
85 EditorChunk(const EditorChunk& rhs);
86 EditorChunk operator=(const EditorChunk& rhs);