[gxml] Added interfaces to provide different backends



commit 6e2f251ce485d0e7ea7a0126c5e3cdbd9b56fef7
Author: Daniel Espinosa <esodan gmail com>
Date:   Tue Apr 14 13:39:01 2015 -0500

    Added interfaces to provide different backends
    
        * Now GXml is based on libxml2 and uses one of
          available possibilities to parse XML files
        * This interfaces will allow to get access to XML
          tree by using different backends parsers
        * Next step is to avoid interfarence with already
          GXml objects definitions

 gxml/Attribute.vala |   26 ++++++++++++++++++++++++++
 gxml/Document.vala  |   30 ++++++++++++++++++++++++++++++
 gxml/Element.vala   |   30 ++++++++++++++++++++++++++++++
 gxml/Namespace.vala |   30 ++++++++++++++++++++++++++++++
 gxml/Node.vala      |   39 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 155 insertions(+), 0 deletions(-)
---
diff --git a/gxml/Attribute.vala b/gxml/Attribute.vala
new file mode 100644
index 0000000..dd93abc
--- /dev/null
+++ b/gxml/Attribute.vala
@@ -0,0 +1,26 @@
+/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 0; tab-width: 2 -*- */
+/* ObjectModel.vala
+ *
+ * Copyright (C) 2015  Daniel Espinosa <esodan gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *      Daniel Espinosa <esodan gmail com>
+ */
+
+using Gee;
+
+public interface GXml.Attribute : Object, GXml.Node {}
+
diff --git a/gxml/Document.vala b/gxml/Document.vala
new file mode 100644
index 0000000..ac704eb
--- /dev/null
+++ b/gxml/Document.vala
@@ -0,0 +1,30 @@
+/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 0; tab-width: 2 -*- */
+/* ObjectModel.vala
+ *
+ * Copyright (C) 2015  Daniel Espinosa <esodan gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *      Daniel Espinosa <esodan gmail com>
+ */
+
+using Gee;
+
+public interface GXml.Document : Object, GXml.Node
+{
+  public abstract GXml.Node root { get; set; }
+  public abstract GLib.File file { get; set; }
+  public abstract string to_string ();
+}
diff --git a/gxml/Element.vala b/gxml/Element.vala
new file mode 100644
index 0000000..fe4eeb7
--- /dev/null
+++ b/gxml/Element.vala
@@ -0,0 +1,30 @@
+/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 0; tab-width: 2 -*- */
+/* ObjectModel.vala
+ *
+ * Copyright (C) 2015  Daniel Espinosa <esodan gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *      Daniel Espinosa <esodan gmail com>
+ */
+
+using Gee;
+
+public interface GXml.Element : Object, GXml.Node
+{
+  public abstract GXml.Node root { get; set; }
+  public abstract GLib.File file { get; set; }
+  public abstract string to_string ();
+}
diff --git a/gxml/Namespace.vala b/gxml/Namespace.vala
new file mode 100644
index 0000000..74f59df
--- /dev/null
+++ b/gxml/Namespace.vala
@@ -0,0 +1,30 @@
+/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 0; tab-width: 2 -*- */
+/* ObjectModel.vala
+ *
+ * Copyright (C) 2013, 2014  Daniel Espinosa <esodan gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *      Daniel Espinosa <esodan gmail com>
+ */
+
+using Gee;
+
+public interface GXml.Namespace : Object
+{
+  public abstract string uri { get; set; }
+  public abstract string prefix { get; set; }
+}
+
diff --git a/gxml/Node.vala b/gxml/Node.vala
new file mode 100644
index 0000000..6380d1f
--- /dev/null
+++ b/gxml/Node.vala
@@ -0,0 +1,39 @@
+/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 0; tab-width: 2 -*- */
+/* ObjectModel.vala
+ *
+ * Copyright (C) 2015  Daniel Espinosa <esodan gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *      Daniel Espinosa <esodan gmail com>
+ */
+
+using Gee;
+
+public interface GXml.Node : Object
+{
+  public abstract Gee.LinkedList<GXml.Namespace> namespaces { get; }
+  public abstract Gee.LinkedList<GXml.Node> childs { get; }
+  public abstract Gee.Map<string,GXml.Node> attrs { get; }
+  public abstract string name { get; construct set; }
+  public abstract string @value { get; set; }
+  public abstract GXml.NodeType type_node { get; construct set; }
+  public abstract GXml.Document document { get; construct set; }
+  public abstract GXml.Node copy ();
+  public abstract string to_string ();
+  public virtual string ns_prefix () { return namespaces.first ().prefix; }
+  public virtual string ns_urf () { return namespaces.first ().uri; }
+}
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]