xs/tree_node.xs

filter: Statementstmt 0.0% 0 / 40 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 52 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« xs/tree_attr.xs ↑ Summary source/myhtml/rules.c »
1 #/*
2 # Copyright 2015-2016 Alexander Borisov
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 # Author: lex.borisov@gmail.com (Alexander Borisov)
17 #*/
18  
19 MODULE = HTML::MyHTML::Tree::Node PACKAGE = HTML::MyHTML::Tree::Node
20 PROTOTYPES: DISABLE
21  
22 #=sort 1
23  
24 SV*
25 info(node, tree)
26 HTML::MyHTML::Tree::Node node;
27 HTML::MyHTML::Tree tree;
28
29 CODE:
30 0 RETVAL = newRV_noinc((SV *)sm_get_node_info(tree, node));
31 OUTPUT:
32 RETVAL
33  
34 #=sort 2
35  
36 HTML::MyHTML::Tree::Node
37 next(node)
38 HTML::MyHTML::Tree::Node node;
39
40 CODE:
41 0 RETVAL = myhtml_node_next(node);
42 OUTPUT:
43 RETVAL
44 POSTCALL:
45 0 ▶ if(RETVAL == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(RETVAL == NULL) 0 0 0
46 0 XSRETURN_UNDEF;
47  
48 #=sort 3
49  
50 HTML::MyHTML::Tree::Node
51 prev(node)
52 HTML::MyHTML::Tree::Node node;
53
54 CODE:
55 0 RETVAL = myhtml_node_prev(node);
56 OUTPUT:
57 RETVAL
58 POSTCALL:
59 0 ▶ if(RETVAL == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(RETVAL == NULL) 0 0 0
60 0 XSRETURN_UNDEF;
61  
62 #=sort 4
63  
64 HTML::MyHTML::Tree::Node
65 parent(node)
66 HTML::MyHTML::Tree::Node node;
67
68 CODE:
69 0 RETVAL = myhtml_node_parent(node);
70 OUTPUT:
71 RETVAL
72 POSTCALL:
73 0 ▶ if(RETVAL == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(RETVAL == NULL) 0 0 0
74 0 XSRETURN_UNDEF;
75  
76 #=sort 5
77  
78 HTML::MyHTML::Tree::Node
79 child(node)
80 HTML::MyHTML::Tree::Node node;
81
82 CODE:
83 0 RETVAL = myhtml_node_child(node);
84 OUTPUT:
85 RETVAL
86 POSTCALL:
87 0 ▶ if(RETVAL == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(RETVAL == NULL) 0 0 0
88 0 XSRETURN_UNDEF;
89  
90 #=sort 6
91  
92 HTML::MyHTML::Tree::Node
93 last_child(node)
94 HTML::MyHTML::Tree::Node node;
95
96 CODE:
97 0 RETVAL = myhtml_node_last_child(node);
98 OUTPUT:
99 RETVAL
100 POSTCALL:
101 0 ▶ if(RETVAL == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(RETVAL == NULL) 0 0 0
102 0 XSRETURN_UNDEF;
103  
104 #=sort 7
105  
106 void
107 free(node, tree)
108 HTML::MyHTML::Tree::Node node;
109 HTML::MyHTML::Tree tree;
110
111 CODE:
112 0 myhtml_node_free(tree, node);
113  
114 #=sort 8
115  
116 HTML::MyHTML::Tree::Node
117 remove(node)
118 HTML::MyHTML::Tree::Node node;
119
120 CODE:
121 0 RETVAL = myhtml_node_remove(node);
122 OUTPUT:
123 RETVAL
124  
125 #=sort 9
126  
127 void
128 delete(node, tree)
129 HTML::MyHTML::Tree::Node node;
130 HTML::MyHTML::Tree tree;
131
132 CODE:
133 0 myhtml_node_delete(tree, node);
134  
135 #=sort 10
136  
137 void
138 delete_recursive(node, tree)
139 HTML::MyHTML::Tree::Node node;
140 HTML::MyHTML::Tree tree;
141
142 CODE:
143 0 myhtml_node_delete_recursive(tree, node);
144  
145 #=sort 11
146  
147 myhtml_tag_id_t
148 tag_id(node)
149 HTML::MyHTML::Tree::Node node;
150
151 CODE:
152 0 RETVAL = myhtml_node_tag_id(node);
153 OUTPUT:
154 RETVAL
155  
156 #=sort 12
157  
158 enum myhtml_namespace
159 namespace(node)
160 HTML::MyHTML::Tree::Node node;
161
162 CODE:
163 0 RETVAL = myhtml_node_namespace(node);
164 OUTPUT:
165 RETVAL
166  
167 #=sort 13
168  
169 SV*
170 tag_name(node, tree)
171 HTML::MyHTML::Tree::Node node;
172 HTML::MyHTML::Tree tree;
173
174 CODE:
175 size_t length;
176 0 const char* name = myhtml_tag_name_by_id(tree, myhtml_node_tag_id(node), &length);
177 0 RETVAL = newSVpv(name, length);
178 OUTPUT:
179 RETVAL
180  
181 #=sort 14
182  
183 bool
184 is_close_self(node)
185 HTML::MyHTML::Tree::Node node;
186
187 CODE:
188 0 RETVAL = myhtml_node_is_close_self(node);
189 OUTPUT:
190 RETVAL
191  
192 #=sort 15
193  
194 HTML::MyHTML::Tree::Attr
195 attr_first(node)
196 HTML::MyHTML::Tree::Node node;
197
198 CODE:
199 0 RETVAL = myhtml_node_attribute_first(node);
200 OUTPUT:
201 RETVAL
202  
203 #=sort 16
204  
205 HTML::MyHTML::Tree::Attr
206 attr_last(node)
207 HTML::MyHTML::Tree::Node node;
208
209 CODE:
210 0 RETVAL = myhtml_node_attribute_last(node);
211 OUTPUT:
212 RETVAL
213  
214 #=sort 17
215  
216 HTML::MyHTML::Tree::Attr
217 attr_add(node, tree, key, value, encoding)
218 HTML::MyHTML::Tree::Node node;
219 HTML::MyHTML::Tree tree;
220 SV* key;
221 SV* value;
222 myhtml_encoding_t encoding;
223
224 PREINIT:
225 STRLEN key_len;
226 STRLEN value_len;
227 CODE:
228 0 ▶ const char *char_key = SvPV(key, key_len);
Branch: 1 branch
BranchTrueFalseTotal
const char *char_key = SvPV(key, key_len); 0 0 0
229 0 const char *char_value = SvPV(key, value_len);
230
231 0 RETVAL = myhtml_attribute_add(tree, node, char_key, key_len, char_value, value_len, encoding);
232 OUTPUT:
233 RETVAL
234  
235 #=sort 18
236  
237 HTML::MyHTML::Tree::Attr
238 attr_remove_by_key(node, key)
239 myhtml_tree_node_t *node;
240 SV* key;
241
242 PREINIT:
243 STRLEN len;
244 CODE:
245 0 const char *char_key = SvPV(key, len);
246 0 RETVAL = myhtml_attribute_remove_by_key(node, char_key, len);
247 OUTPUT:
248 RETVAL
249  
250 #=sort 19
251  
252 HTML::MyHTML::Tree::Attr
253 attr_by_key(node, key)
254 myhtml_tree_node_t *node;
255 SV* key;
256
257 PREINIT:
258 STRLEN len;
259 CODE:
260 0 const char *char_key = SvPV(key, len);
261 0 RETVAL = myhtml_attribute_by_key(node, char_key, len);
262 OUTPUT:
263 RETVAL
264  
265 #=sort 20
266  
267 SV*
268 text(node)
269 HTML::MyHTML::Tree::Node node;
270
271 CODE:
272 size_t length;
273 0 const char* text = myhtml_node_text(node, &length);
274 0 RETVAL = newSVpv(text, length);
275 OUTPUT:
276 RETVAL
277  
278 #=sort 21
279  
280 HTML::MyHTML::String
281 string(node)
282 HTML::MyHTML::Tree::Node node;
283
284 CODE:
285 0 RETVAL = myhtml_node_string(node);
286 OUTPUT:
287 RETVAL
288  
289 #=sort 22
290  
291 void
292 print(node, tree, fh, inc)
293 HTML::MyHTML::Tree::Node node;
294 HTML::MyHTML::Tree tree;
295 FILE* fh;
296 size_t inc;
297
298 CODE:
299 0 myhtml_tree_print_by_node(tree, node, fh, inc);
300  
301 #=sort 23
302  
303 void
304 print_children(node, tree, fh, inc)
305 HTML::MyHTML::Tree::Node node;
306 HTML::MyHTML::Tree tree;
307 FILE* fh;
308 size_t inc;
309
310 CODE:
311 0 myhtml_tree_print_node_childs(tree, node, fh, inc);
312  
313 #=sort 24
314  
315 void
316 print_all(node, tree, fh)
317 HTML::MyHTML::Tree::Node node;
318 HTML::MyHTML::Tree tree;
319 FILE* fh;
320
321 CODE:
322 0 myhtml_tree_print_node(tree, node, fh);
323  
« xs/tree_attr.xs ↑ Summary source/myhtml/rules.c »