diff mde/file/mergetag/Writer.d @ 136:4084f07f2c7a

Added simpler mergetag readers and writers, with unittest.
author Diggory Hardy <diggory.hardy@gmail.com>
date Sun, 01 Feb 2009 12:36:21 +0000
parents b16a534f5302
children 9f035cd139c6
line wrap: on
line diff
--- a/mde/file/mergetag/Writer.d	Fri Jan 30 15:51:42 2009 +0000
+++ b/mde/file/mergetag/Writer.d	Sun Feb 01 12:36:21 2009 +0000
@@ -38,7 +38,6 @@
 import tango.core.Exception;
 import tango.io.device.File;
 import tango.io.stream.Buffer;
-import convInt = tango.text.convert.Integer;
 import tango.util.log.Log : Log, Logger;
 
 private Logger logger;
@@ -135,12 +134,6 @@
         
     
 private:
-    // taken from tango.io.Console, mostly to make sure notepad can read our files:
-    version (Win32)
-        const char[] Eol = "\r\n";
-    else
-        const char[] Eol = "\n";
-
     /* The container where data is written from. */
     DataSet _dataset;
     
@@ -188,7 +181,7 @@
             scope(exit) buffer.flush();
             
             // Write the header:
-            buffer.append ("{MT" ~ MTFormatVersion.CurrentString ~ "}" ~ Eol);
+            buffer.append ("{" ~ CurrentVersionString ~ "}" ~ Eol);
             if (_dataset.header !is null) writeSection (buffer, _dataset.header);
         
             // Write the rest:
@@ -209,13 +202,12 @@
     }
         
     private void writeSectionIdentifier (BufferOutput buffer, ID id) {
-        char[] tp = "{" ~ cast(char[])id ~ "}" ~ Eol;
-        buffer.append (tp);
+        buffer.append ("{" ~ id ~ "}" ~ Eol);
     }
     
     private void writeSection (BufferOutput buffer, IDataSection sec) {
         void writeItem (char[] tp, ID id, char[] dt) {	// actually writes an item
-            buffer.append ("<" ~ tp ~ "|" ~ cast(char[])id ~"=" ~ dt ~ ">" ~ Eol);
+            buffer.append ("<" ~ tp ~ "|" ~ id ~"=" ~ dt ~ ">" ~ Eol);
         }
         sec.writeAll (&writeItem);