Debian Codegraph @

libgdome/gdomecore/gdome-xml-entityref.c

raw
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
2 /* gdome-xml-entityref.c
3 *
4 * Copyright (C) 2001 Paolo Casarini <[email protected]>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #include <string.h>
22 #include "gdome.h"
23 #include "gdome-xml-util.h"
24 #include "gdome-xml-node.h"
25 #include "gdome-xml-entityref.h"
26
27 const GdomeEntityReferenceVtab gdome_xml_er_vtab = {
28 {
29 gdome_xml_n_ref,
30 gdome_xml_n_unref,
31 gdome_xml_er_query_interface,
32 gdome_xml_n_nodeName,
33 gdome_xml_n_nodeValue,
34 gdome_xml_n_set_nodeValue,
35 gdome_xml_n_nodeType,
36 gdome_xml_n_parentNode,
37 gdome_xml_n_childNodes,
38 gdome_xml_n_firstChild,
39 gdome_xml_n_lastChild,
40 gdome_xml_n_previousSibling,
41 gdome_xml_n_nextSibling,
42 gdome_xml_n_attributes,
43 gdome_xml_n_ownerDocument,
44 gdome_xml_n_insertBefore,
45 gdome_xml_n_replaceChild,
46 gdome_xml_n_removeChild,
47 gdome_xml_n_appendChild,
48 gdome_xml_n_hasChildNodes,
49 gdome_xml_n_cloneNode,
50 gdome_xml_n_normalize,
51 gdome_xml_n_isSupported,
52 gdome_xml_n_namespaceURI,
53 gdome_xml_n_prefix,
54 gdome_xml_n_set_prefix,
55 gdome_xml_n_localName,
56 gdome_xml_n_hasAttributes,
57 gdome_xml_n_addEventListener,
58 gdome_xml_n_removeEventListener,
59 gdome_xml_n_dispatchEvent,
60 gdome_xml_n_subTreeDispatchEvent
61 }
62 };
63
64 /**
65 * gdome_xml_er_query_interface:
66 * @self: Node Object ref
67 * @interface: interface needed
68 * @exc: Exception Object ref
69 *
70 * Returns: a reference to this object that implements the @interface needed,
71 * or %NULL if the @interface is not supported by this Object.
72 */
73 gpointer
74 gdome_xml_er_query_interface (GdomeNode *self, const char *interface, GdomeException *exc)
75 {
76 Gdome_xml_EntityReference *priv = (Gdome_xml_EntityReference *)self;
77
78 g_return_val_if_fail (priv != NULL, NULL);
79 g_return_val_if_fail (GDOME_XML_IS_ER (priv), NULL);
80 g_return_val_if_fail (interface != NULL, NULL);
81 g_return_val_if_fail (exc != NULL, NULL);
82
83 if (!strcmp (interface, "Node") ||
84 !strcmp (interface, "EntityReference") ||
85 !strcmp (interface, "EventTarget")) {
86 priv->refcnt++;
87 return self;
88 }
89 else
90 return NULL;
91 }
92