Adding first code drop
[demorecorder] / src / Tagging.vala
diff --git a/src/Tagging.vala b/src/Tagging.vala
new file mode 100644 (file)
index 0000000..9947fa5
--- /dev/null
@@ -0,0 +1,56 @@
+/*  Demo Recorder for MAEMO 5
+*   Copyright (C) 2010 Dru Moore <usr@dru-id.co.uk>
+*   This program is free software; you can redistribute it and/or modify
+*   it under the terms of the GNU General Public License version 2,
+*   or (at your option) any later version, as published by the Free
+*   Software Foundation
+*
+*   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, write to the
+*   Free Software Foundation, Inc.,
+*   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+*/
+namespace IdWorks {
+
+  namespace Tagging {
+  
+    public struct Tag {
+      string tag;
+      GLib.Value value;
+      public string to_xml_string() {
+        return ("<Tag>\n" +
+                "<tag type=\"%s\">%s</tag>\n" +
+                "<value type=\"Value\">%s</value>\n" +
+                "</Tag>\n").printf(
+                  value.type_name(), tag
+                  , value.strdup_contents()
+                );
+      }
+      public void from_xml_node(Xml.Node* node) {
+        // Tag is root
+      }
+      public void from_xml_node_helper(Xml.Node* node) {
+        // Tag is below root
+      }
+      public static string taglist_to_xml_string(List<Tag?> taglist) {
+        string ret = "<TagList>\n";
+        for (int idx = 0; idx < taglist.length(); ++idx) {
+          ret += ((Tagging.Tag)taglist.nth_data(idx)).to_xml_string();
+        }
+        return ret + "</TagList>\n";
+      }
+      public static void taglist_from_xml_node_helper(Xml.Node* node, ref unowned List<Tag?> taglist) {
+      }
+      
+      public static void taglist_from_xml_node(Xml.Node* node, ref unowned List<Tag?> taglist) {
+      }
+    }
+  
+  }
+
+}
\ No newline at end of file