diff mde/file/mergetag/iface/IWriter.d @ 81:d8fccaa45d5f

Moved file IO code from mde/mergetag to mde/file[/mergetag] and changed how some errors are caught.
author Diggory Hardy <diggory.hardy@gmail.com>
date Fri, 29 Aug 2008 11:59:43 +0100
parents mde/mergetag/iface/IWriter.d@611f7b9063c6
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mde/file/mergetag/iface/IWriter.d	Fri Aug 29 11:59:43 2008 +0100
@@ -0,0 +1,48 @@
+/* LICENSE BLOCK
+Part of mde: a Modular D game-oriented Engine
+Copyright © 2007-2008 Diggory Hardy
+
+This program is free software: you can redistribute it and/or modify it under the terms
+of the GNU General Public License as published by the Free Software Foundation, either
+version 2 of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+/**
+* Interface for writers.
+*/
+module mde.file.mergetag.iface.IWriter;
+
+import mde.file.mergetag.DataSet;
+
+
+/** Interface for all mergetag writers (MTTWriter etc.).
+*/
+interface IWriter {
+    DataSet dataset ();                 /// Get the DataSet
+    void dataset (DataSet);             /// Set the DataSet
+    
+    void write ();                      /// Commence writing
+}
+
+/**
+* Enumeration for specifying the writing method ("Params" section shows possible values).
+*
+* Params:
+* FromExtension = Determine writing format from file name extension (must be one of .mtb or .mtt).
+* Binary = Use binary mode (adds extension .mtb without checking for an existing extension).
+* Text = Use text mode (adds extension .mtt without checking for an existing extension).
+* Both = Write simultaneously in binary and text modes (with appropriate extensions added to each
+* file name.
+*/
+enum WriterMethod : byte {
+    FromExtension = -1,
+    Binary = 1,
+    Text = 2,
+    Both = 3
+}