[lasem] dom_named_node_map: base class.



commit f39314014250cd797822991884d835717d31dada
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Sun Nov 21 21:05:18 2010 +0100

    dom_named_node_map: base class.

 docs/reference/lasem/lasem-docs.xml     |    1 +
 docs/reference/lasem/lasem-sections.txt |   20 ++++++++
 src/Makefile.am                         |    2 +
 src/lsmdomnamednodemap.c                |   81 +++++++++++++++++++++++++++++++
 src/lsmdomnamednodemap.h                |   64 ++++++++++++++++++++++++
 src/lsmdomtypes.h                       |    1 +
 6 files changed, 169 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/lasem/lasem-docs.xml b/docs/reference/lasem/lasem-docs.xml
index 22f1e58..1cac59e 100644
--- a/docs/reference/lasem/lasem-docs.xml
+++ b/docs/reference/lasem/lasem-docs.xml
@@ -40,6 +40,7 @@
 			<title>DOM</title>
 			<xi:include href="xml/lsmdomnode.xml"/>
 			<xi:include href="xml/lsmdomnodelist.xml"/>
+			<xi:include href="xml/lsmdomnamednodemap.xml"/>
 			<xi:include href="xml/lsmdomdocument.xml"/>
 			<xi:include href="xml/lsmdomdocumentfragment.xml"/>
 			<xi:include href="xml/lsmdomelement.xml"/>
diff --git a/docs/reference/lasem/lasem-sections.txt b/docs/reference/lasem/lasem-sections.txt
index e64d24c..6602c4e 100644
--- a/docs/reference/lasem/lasem-sections.txt
+++ b/docs/reference/lasem/lasem-sections.txt
@@ -68,6 +68,26 @@ LSM_TYPE_DOM_NODE_LIST
 </SECTION>
 
 <SECTION>
+<FILE>lsmdomnamednodemap</FILE>
+<TITLE>LsmDomNamedNodeMap</TITLE>
+lsm_dom_named_node_map_get_item
+lsm_dom_named_node_map_get_length
+lsm_dom_named_node_map_get_named_item
+lsm_dom_named_node_map_set_named_item
+lsm_dom_named_node_map_remove_named_item
+<SUBSECTION Standard>
+LSM_DOM_NAMED_NODE_MAP
+LSM_DOM_NAMED_NODE_MAP_CLASS
+LSM_DOM_NAMED_NODE_MAP_GET_CLASS
+LSM_IS_DOM_NAMED_NODE_MAP
+LSM_IS_DOM_NAMED_NODE_MAP_CLASS
+LSM_TYPE_DOM_NAMED_NODE_MAP
+LsmDomNamedNodeMap
+LsmDomNamedNodeMapClass
+lsm_dom_named_node_map_get_type
+</SECTION>
+
+<SECTION>
 <FILE>lsmdomdocument</FILE>
 <TITLE>LsmDomDocument</TITLE>
 LSM_DOM_DOCUMENT_DEFAULT_RESOLUTION
diff --git a/src/Makefile.am b/src/Makefile.am
index f912d47..03b69ed 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -44,6 +44,7 @@ LASEM_DOM_SRCS =				\
 	lsmdomenumtypes.c			\
 	lsmdomnode.c				\
 	lsmdomnodelist.c			\
+	lsmdomnamednodemap.c			\
 	lsmdomdocument.c			\
 	lsmdomdocumentfragment.c		\
 	lsmdomelement.c				\
@@ -142,6 +143,7 @@ LASEM_DOM_HDRS = 				\
 	lsmdomtypes.h				\
 	lsmdomnode.h				\
 	lsmdomnodelist.h			\
+	lsmdomnamednodemap.h			\
 	lsmdomdocument.h			\
 	lsmdomdocumentfragment.h		\
 	lsmdomelement.h				\
diff --git a/src/lsmdomnamednodemap.c b/src/lsmdomnamednodemap.c
new file mode 100644
index 0000000..282c319
--- /dev/null
+++ b/src/lsmdomnamednodemap.c
@@ -0,0 +1,81 @@
+/* Lasem - SVG and Mathml library
+ *
+ * Copyright © 2010 Emmanuel Pacaud
+ *
+ * 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 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author:
+ * 	Emmanuel Pacaud <emmanuel gnome org>
+ */
+
+#include <lsmdomnamednodemap.h>
+#include <lsmdomnode.h>
+
+/* LsmDomNamedNodeMap implementation */
+
+LsmDomNode *
+lsm_dom_named_node_map_get_named_item (LsmDomNamedNodeMap *map, const char *name)
+{
+	g_return_val_if_fail (LSM_IS_DOM_NAMED_NODE_MAP (map), NULL);
+
+	return LSM_DOM_NAMED_NODE_MAP_GET_CLASS (map)->get (map, name);
+}
+
+LsmDomNode *
+lsm_dom_named_node_map_set_named_item (LsmDomNamedNodeMap *map, LsmDomNode *node)
+{
+	g_return_val_if_fail (LSM_IS_DOM_NAMED_NODE_MAP (map), NULL);
+
+	return LSM_DOM_NAMED_NODE_MAP_GET_CLASS (map)->set (map, node);
+}
+
+LsmDomNode *
+lsm_dom_named_node_map_remove_named_item (LsmDomNamedNodeMap *map, const char *name)
+{
+	g_return_val_if_fail (LSM_IS_DOM_NAMED_NODE_MAP (map), NULL);
+
+	return LSM_DOM_NAMED_NODE_MAP_GET_CLASS (map)->remove (map, name);
+}
+
+LsmDomNode *
+lsm_dom_named_node_map_get_item (LsmDomNamedNodeMap *map, unsigned int index)
+{
+	g_return_val_if_fail (LSM_IS_DOM_NAMED_NODE_MAP (map), NULL);
+
+	return LSM_DOM_NAMED_NODE_MAP_GET_CLASS (map)->get_item (map, index);
+}
+
+unsigned int
+lsm_dom_named_node_map_get_length (LsmDomNamedNodeMap *map)
+{
+	g_return_val_if_fail (LSM_IS_DOM_NAMED_NODE_MAP (map), 0);
+
+	return LSM_DOM_NAMED_NODE_MAP_GET_CLASS (map)->get_length (map);
+}
+
+static void
+lsm_dom_named_node_map_init (LsmDomNamedNodeMap *map)
+{
+}
+
+/* LsmDomNamedNodeMap class */
+
+static void
+lsm_dom_named_node_map_class_init (LsmDomNamedNodeMapClass *klass)
+{
+}
+
+G_DEFINE_ABSTRACT_TYPE (LsmDomNamedNodeMap, lsm_dom_named_node_map, G_TYPE_OBJECT)
diff --git a/src/lsmdomnamednodemap.h b/src/lsmdomnamednodemap.h
new file mode 100644
index 0000000..e61d67f
--- /dev/null
+++ b/src/lsmdomnamednodemap.h
@@ -0,0 +1,64 @@
+/* Lasem - SVG and Mathml library
+ *
+ * Copyright © 2010 Emmanuel Pacaud
+ *
+ * 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 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author:
+ * 	Emmanuel Pacaud <emmanuel gnome org>
+ */
+
+#ifndef LSM_DOM_NAMED_NODE_MAP_H
+#define LSM_DOM_NAMED_NODE_MAP_H
+
+#include <lsmdomtypes.h>
+
+G_BEGIN_DECLS
+
+#define LSM_TYPE_DOM_NAMED_NODE_MAP             (lsm_dom_named_node_map_get_type ())
+#define LSM_DOM_NAMED_NODE_MAP(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), LSM_TYPE_DOM_NAMED_NODE_MAP, LsmDomNamedNodeMap))
+#define LSM_DOM_NAMED_NODE_MAP_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), LSM_TYPE_DOM_NAMED_NODE_MAP, LsmDomNamedNodeMapClass))
+#define LSM_IS_DOM_NAMED_NODE_MAP(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LSM_TYPE_DOM_NAMED_NODE_MAP))
+#define LSM_IS_DOM_NAMED_NODE_MAP_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), LSM_TYPE_DOM_NAMED_NODE_MAP))
+#define LSM_DOM_NAMED_NODE_MAP_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj), LSM_TYPE_DOM_NAMED_NODE_MAP, LsmDomNamedNodeMapClass))
+
+typedef struct _LsmDomNamedNodeMapClass LsmDomNamedNodeMapClass;
+
+struct _LsmDomNamedNodeMap {
+	GObject	object;
+};
+
+struct _LsmDomNamedNodeMapClass {
+	GObjectClass parent_class;
+
+	LsmDomNode *	(*get) 			(LsmDomNamedNodeMap *map, const char *name);
+	LsmDomNode *	(*set) 			(LsmDomNamedNodeMap *map, LsmDomNode *node);
+	LsmDomNode *	(*remove) 		(LsmDomNamedNodeMap *map, const char *name);
+	LsmDomNode *	(*get_item) 		(LsmDomNamedNodeMap *map, unsigned int index);
+	unsigned int	(*get_length)		(LsmDomNamedNodeMap *map);
+};
+
+GType lsm_dom_named_node_map_get_type (void);
+
+LsmDomNode *		lsm_dom_named_node_map_get_named_item 		(LsmDomNamedNodeMap *map, const char *name);
+LsmDomNode *		lsm_dom_named_node_map_set_named_item 		(LsmDomNamedNodeMap *map, LsmDomNode *item);
+LsmDomNode *		lsm_dom_named_node_map_remove_named_item	(LsmDomNamedNodeMap *map, const char *name);
+LsmDomNode *		lsm_dom_named_node_map_get_item 		(LsmDomNamedNodeMap *map, unsigned int index);
+unsigned int		lsm_dom_named_node_map_get_length		(LsmDomNamedNodeMap *map);
+
+G_END_DECLS
+
+#endif
diff --git a/src/lsmdomtypes.h b/src/lsmdomtypes.h
index 60ea309..1c71b1d 100644
--- a/src/lsmdomtypes.h
+++ b/src/lsmdomtypes.h
@@ -30,6 +30,7 @@ G_BEGIN_DECLS
 
 typedef struct _LsmDomNode LsmDomNode;
 typedef struct _LsmDomNodeList LsmDomNodeList;
+typedef struct _LsmDomNamedNodeMap LsmDomNamedNodeMap;
 typedef struct _LsmDomElement LsmDomElement;
 typedef struct _LsmDomDocument LsmDomDocument;
 typedef struct _LsmDomDocumentFragment LsmDomDocumentFragment;



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