gwenhywfar 5.10.1
htmlgroup.c
Go to the documentation of this file.
1/***************************************************************************
2 begin : Sat Feb 20 2010
3 copyright : (C) 2010 by Martin Preuss
4 email : martin@libchipcard.de
5
6 ***************************************************************************
7 * Please see toplevel file COPYING for license details *
8 ***************************************************************************/
9
10#ifdef HAVE_CONFIG_H
11# include <config.h>
12#endif
13
14#define DISABLE_DEBUGLOG
15
16
17#include "htmlgroup_p.h"
18
19#include <gwenhywfar/misc.h>
20#include <gwenhywfar/debug.h>
21
22
23
25
26
27
28
29
30HTML_GROUP *HtmlGroup_new(const char *groupName,
31 HTML_GROUP *parent,
33{
34 HTML_GROUP *g;
35
38 g->parent=parent;
39 g->xmlContext=ctx;
40 if (groupName)
41 g->groupName=strdup(groupName);
42 if (g->xmlContext==NULL && g->parent)
43 g->xmlContext=parent->xmlContext;
44
45 return g;
46}
47
48
49
51{
52 if (g) {
54
55 HtmlProps_free(g->properties);
56 free(g->groupName);
57
59 }
60}
61
62
63
65{
66 assert(g);
67 return g->parent;
68}
69
70
71
73{
74 assert(g);
75 return g->xmlContext;
76}
77
78
79
81{
82 assert(g);
83 return g->groupName;
84}
85
86
87
89{
90 assert(g);
91 return g->object;
92}
93
94
95
97{
98 assert(g);
99 g->object=o;
100}
101
102
103
105{
106 assert(g);
107 return g->properties;
108}
109
110
111
113{
114 assert(g);
115
117 HtmlProps_free(g->properties);
118 g->properties=pr;
119}
120
121
122
123
124
125
126
127
130{
132
133 assert(g);
134 oldFn=g->startTagFn;
135 g->startTagFn=f;
136 return oldFn;
137}
138
139
140
143{
145
146 assert(g);
147 oldFn=g->endTagFn;
148 g->endTagFn=f;
149 return oldFn;
150}
151
152
153
156{
158
159 assert(g);
160 oldFn=g->addDataFn;
161 g->addDataFn=f;
162 return oldFn;
163}
164
165
166
169{
171
172 assert(g);
173 oldFn=g->endSubGroupFn;
174 g->endSubGroupFn=f;
175 return oldFn;
176}
177
178
179
180
181
183 const char *tagName)
184{
185 assert(g);
186 if (g->startTagFn)
187 return g->startTagFn(g, tagName);
188 else
190}
191
192
193
195 const char *tagName)
196{
197 assert(g);
198 if (g->endTagFn)
199 return g->endTagFn(g, tagName);
200 else
202}
203
204
205
207 const char *data)
208{
209 assert(g);
210 if (g->addDataFn)
211 return g->addDataFn(g, data);
212 else
214}
215
216
217
219{
220 assert(g);
221 if (g->endSubGroupFn)
222 return g->endSubGroupFn(g, sg);
223 else
225}
226
227
228
229
230
#define NULL
Definition: binreloc.c:300
#define GWEN_ERROR_NOT_IMPLEMENTED
Definition: error.h:108
const char * HtmlGroup_GetGroupName(const HTML_GROUP *g)
Definition: htmlgroup.c:80
int HtmlGroup_EndTag(HTML_GROUP *g, const char *tagName)
Definition: htmlgroup.c:194
void HtmlGroup_SetObject(HTML_GROUP *g, HTML_OBJECT *o)
Definition: htmlgroup.c:96
int HtmlGroup_StartTag(HTML_GROUP *g, const char *tagName)
Definition: htmlgroup.c:182
void HtmlGroup_free(HTML_GROUP *g)
Definition: htmlgroup.c:50
int HtmlGroup_AddData(HTML_GROUP *g, const char *data)
Definition: htmlgroup.c:206
HTML_GROUP_ADDDATA_FN HtmlGroup_SetAddDataFn(HTML_GROUP *g, HTML_GROUP_ADDDATA_FN f)
Definition: htmlgroup.c:154
HTML_GROUP_ENDSUBGROUP_FN HtmlGroup_SetEndSubGroupFn(HTML_GROUP *g, HTML_GROUP_ENDSUBGROUP_FN f)
Definition: htmlgroup.c:167
HTML_GROUP * HtmlGroup_new(const char *groupName, HTML_GROUP *parent, GWEN_XML_CONTEXT *ctx)
Definition: htmlgroup.c:30
HTML_OBJECT * HtmlGroup_GetObject(const HTML_GROUP *g)
Definition: htmlgroup.c:88
int HtmlGroup_EndSubGroup(HTML_GROUP *g, HTML_GROUP *sg)
Definition: htmlgroup.c:218
GWEN_XML_CONTEXT * HtmlGroup_GetXmlContext(const HTML_GROUP *g)
Definition: htmlgroup.c:72
HTML_PROPS * HtmlGroup_GetProperties(const HTML_GROUP *g)
Definition: htmlgroup.c:104
HTML_GROUP_ENDTAG_FN HtmlGroup_SetEndTagFn(HTML_GROUP *g, HTML_GROUP_ENDTAG_FN f)
Definition: htmlgroup.c:141
void HtmlGroup_SetProperties(HTML_GROUP *g, HTML_PROPS *pr)
Definition: htmlgroup.c:112
HTML_GROUP_STARTTAG_FN HtmlGroup_SetStartTagFn(HTML_GROUP *g, HTML_GROUP_STARTTAG_FN f)
Definition: htmlgroup.c:128
HTML_GROUP * HtmlGroup_GetParent(const HTML_GROUP *g)
Definition: htmlgroup.c:64
struct HTML_GROUP HTML_GROUP
Definition: htmlgroup_l.h:19
int(* HTML_GROUP_ADDDATA_FN)(HTML_GROUP *g, const char *data)
Definition: htmlgroup_l.h:27
int(* HTML_GROUP_STARTTAG_FN)(HTML_GROUP *g, const char *tagName)
Definition: htmlgroup_l.h:23
int(* HTML_GROUP_ENDSUBGROUP_FN)(HTML_GROUP *g, HTML_GROUP *sg)
Definition: htmlgroup_l.h:30
int(* HTML_GROUP_ENDTAG_FN)(HTML_GROUP *g, const char *tagName)
Definition: htmlgroup_l.h:25
struct HTML_OBJECT HTML_OBJECT
Definition: htmlobject_be.h:25
void HtmlProps_free(HTML_PROPS *pr)
Definition: htmlprops.c:40
void HtmlProps_Attach(HTML_PROPS *pr)
Definition: htmlprops.c:73
struct HTML_PROPS HTML_PROPS
Definition: htmlprops_be.h:15
#define GWEN_INHERIT_FUNCTIONS(t)
Definition: inherit.h:163
#define GWEN_INHERIT_INIT(t, element)
Definition: inherit.h:223
#define GWEN_INHERIT_FINI(t, element)
Definition: inherit.h:238
#define GWEN_FREE_OBJECT(varname)
Definition: memory.h:61
#define GWEN_NEW_OBJECT(typ, varname)
Definition: memory.h:55
struct GWEN_XML_CONTEXT GWEN_XML_CONTEXT
Definition: xmlctx.h:39