]> icculus.org git repositories - divverent/netradiant.git/blob - include/imap.h
new feature to smooth patches
[divverent/netradiant.git] / include / imap.h
1 /*
2 Copyright (C) 2001-2006, William Joseph.
3 All Rights Reserved.
4
5 This file is part of GtkRadiant.
6
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20 */
21
22 #if !defined(INCLUDED_IMAP_H)
23 #define INCLUDED_IMAP_H
24
25 #include "generic/constant.h"
26
27 class Tokeniser;
28 class TokenWriter;
29
30 /// \brief A node whose state can be imported from a token stream.
31 class MapImporter
32 {
33 public:
34   STRING_CONSTANT(Name, "MapImporter");
35
36   virtual bool importTokens(Tokeniser& tokeniser) = 0;
37 };
38
39 /// \brief A node whose state can be exported to a token stream.
40 class MapExporter
41 {
42 public:
43   STRING_CONSTANT(Name, "MapExporter");
44
45   virtual void exportTokens(TokenWriter& writer) const = 0;
46 };
47
48 #include "iscenegraph.h"
49
50 class EntityCreator;
51
52 class TextInputStream;
53 class TextOutputStream;
54
55
56 typedef void(*GraphTraversalFunc)(scene::Node& root, const scene::Traversable::Walker& walker);
57
58 /// \brief A module that reads and writes a map in a specific format.
59 class MapFormat
60 {
61 public:
62   INTEGER_CONSTANT(Version, 2);
63   STRING_CONSTANT(Name, "map");
64
65   /// \brief Read a map graph into \p root from \p outputStream, using \p entityTable to create entities.
66   virtual void readGraph(scene::Node& root, TextInputStream& inputStream, EntityCreator& entityTable) const = 0;
67   /// \brief Write the map graph obtained by applying \p traverse to \p root into \p outputStream.
68   virtual void writeGraph(scene::Node& root, GraphTraversalFunc traverse, TextOutputStream& outputStream) const = 0;
69 };
70
71
72 template<typename Type>
73 class Modules;
74 typedef Modules<MapFormat> MapModules;
75
76 template<typename Type>
77 class ModulesRef;
78 typedef ModulesRef<MapFormat> MapModulesRef;
79
80
81 #endif