Debian Codegraph @

libgdome/gdomecore/gdome-xml-documentf.c

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