Debian Codegraph @

libgdome/gdomecore/gdome-xml-cdatas.c

raw
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
2 /* gdome-xml-cdatas.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-cdata.h"
26 #include "gdome-xml-text.h"
27 #include "gdome-xml-cdatas.h"
28
29
30 const GdomeCDATASectionVtab gdome_xml_cds_vtab = {
31 {
32 {
33 {
34 gdome_xml_n_ref,
35 gdome_xml_n_unref,
36 gdome_xml_cds_query_interface,
37 gdome_xml_n_nodeName,
38 gdome_xml_n_nodeValue,
39 gdome_xml_n_set_nodeValue,
40 gdome_xml_n_nodeType,
41 gdome_xml_n_parentNode,
42 gdome_xml_n_childNodes,
43 gdome_xml_n_firstChild,
44 gdome_xml_n_lastChild,
45 gdome_xml_n_previousSibling,
46 gdome_xml_n_nextSibling,
47 gdome_xml_n_attributes,
48 gdome_xml_n_ownerDocument,
49 gdome_xml_n_insertBefore,
50 gdome_xml_n_replaceChild,
51 gdome_xml_n_removeChild,
52 gdome_xml_n_appendChild,
53 gdome_xml_n_hasChildNodes,
54 gdome_xml_n_cloneNode,
55 gdome_xml_n_normalize,
56 gdome_xml_n_isSupported,
57 gdome_xml_n_namespaceURI,
58 gdome_xml_n_prefix,
59 gdome_xml_n_set_prefix,
60 gdome_xml_n_localName,
61 gdome_xml_n_hasAttributes,
62 gdome_xml_n_addEventListener,
63 gdome_xml_n_removeEventListener,
64 gdome_xml_n_dispatchEvent,
65 gdome_xml_n_subTreeDispatchEvent
66 },
67 gdome_xml_cd_data,
68 gdome_xml_cd_set_data,
69 gdome_xml_cd_length,
70 gdome_xml_cd_substringData,
71 gdome_xml_cd_appendData,
72 gdome_xml_cd_insertData,
73 gdome_xml_cd_deleteData,
74 gdome_xml_cd_replaceData
75 },
76 gdome_xml_t_splitText
77 },
78 };
79
80 /**
81 * gdome_xml_cds_query_interface:
82 * @self: Node Object ref
83 * @interface: interface needed
84 * @exc: Exception Object ref
85 *
86 * Returns: a reference to this object that implements the @interface needed,
87 * or %NULL if the @interface is not supported by this Object.
88 */
89 gpointer
90 gdome_xml_cds_query_interface (GdomeNode *self, const char *interface, GdomeException *exc)
91 {
92 Gdome_xml_CDATASection *priv = (Gdome_xml_CDATASection *)self;
93
94 g_return_val_if_fail (priv != NULL, NULL);
95 g_return_val_if_fail (GDOME_XML_IS_CDS (priv), NULL);
96 g_return_val_if_fail (interface != NULL, NULL);
97 g_return_val_if_fail (exc != NULL, NULL);
98
99 if (!strcmp (interface, "Node") ||
100 !strcmp (interface, "CharacterData") ||
101 !strcmp (interface, "Text") ||
102 !strcmp (interface, "CDATASection") ||
103 !strcmp (interface, "EventTarget")) {
104 priv->refcnt++;
105 return self;
106 }
107 else
108 return NULL;
109 }