Mercurial > projects > orange
changeset 11:27c5b6c5425f 0.0.1
Deserialization now works as well using D2. Compiles again with D1 and Tango. Cleaned up orange.util.io a bit.
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 25 Jul 2010 13:25:55 +0200 |
parents | d17ae98330bf |
children | 02659867eac2 |
files | .hgignore orange/serialization/archives/XMLArchive.d orange/util/io.d orange/xml/PhobosXML.d |
diffstat | 4 files changed, 11 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Sat Jul 24 19:37:45 2010 +0200 +++ b/.hgignore Sun Jul 25 13:25:55 2010 +0200 @@ -12,5 +12,6 @@ *.dylib main.d main +main.d.deps *.framework kandil \ No newline at end of file
--- a/orange/serialization/archives/XMLArchive.d Sat Jul 24 19:37:45 2010 +0200 +++ b/orange/serialization/archives/XMLArchive.d Sun Jul 25 13:25:55 2010 +0200 @@ -7,11 +7,7 @@ module orange.serialization.archives.XMLArchive; version (Tango) -{ - /*import tango.text.xml.DocPrinter; - import tango.text.xml.Document;*/ import tango.util.Convert : to; -} else import std.conv; @@ -347,7 +343,7 @@ } auto tmp = getElement(Tags.objectTag, key, Attributes.keyAttribute, false); - + if (!tmp.isValid) { lastElement = getElement(Tags.nullTag, key); @@ -488,7 +484,7 @@ } private doc.Node getElement (DataType tag, DataType key, DataType attribute = Attributes.keyAttribute, bool throwOnError = true) - { + { auto set = lastElement.query[tag].attribute((doc.Node node) { if (node.name == attribute && node.value == key) return true; @@ -509,7 +505,7 @@ else throw new ArchiveException(`Could not unarchive the value with the key "` ~ to!(string)(key) ~ `" due to malformed data.`, __FILE__, __LINE__); } - + return doc.Node.invalid; } }
--- a/orange/util/io.d Sat Jul 24 19:37:45 2010 +0200 +++ b/orange/util/io.d Sun Jul 25 13:25:55 2010 +0200 @@ -39,8 +39,7 @@ else - foreach(t ; a) - write(t); + write(args); } /** @@ -63,10 +62,5 @@ } else - { - foreach(t ; args) - write(t); - - write("\n"); - } + writeln(args); } \ No newline at end of file
--- a/orange/xml/PhobosXML.d Sat Jul 24 19:37:45 2010 +0200 +++ b/orange/xml/PhobosXML.d Sun Jul 25 13:25:55 2010 +0200 @@ -127,7 +127,7 @@ version (Phobos): -import std.array; +mixin(`import std.array; import std.string; import std.encoding; @@ -139,11 +139,12 @@ private tstring name_; private tstring value_; - this (tstring name, tstring value) + this (tstring name, tstring value, Element parent) { super(name); name_ = name; value_ = value; + parent_ = parent; } tstring name () @@ -769,7 +770,7 @@ attrs = attrs[0 .. 0]; foreach (k, v ; tag.attr) - attrs ~= new Attribute(k, v); + attrs ~= new Attribute(k, v, this); return attrs; } @@ -3044,5 +3045,5 @@ { throw new XMLException(s); } -} +}`);