File Coverage

third_party/modest/source/modest/node/serialization.c
Criterion Covered Total %
statement 0 18 0.0
branch 0 10 0.0
condition n/a
subroutine n/a
pod n/a
total 0 28 0.0


line stmt bran cond sub pod time code
1             /*
2             Copyright (C) 2016-2017 Alexander Borisov
3            
4             This library is free software; you can redistribute it and/or
5             modify it under the terms of the GNU Lesser General Public
6             License as published by the Free Software Foundation; either
7             version 2.1 of the License, or (at your option) any later version.
8            
9             This library is distributed in the hope that it will be useful,
10             but WITHOUT ANY WARRANTY; without even the implied warranty of
11             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12             Lesser General Public License for more details.
13            
14             You should have received a copy of the GNU Lesser General Public
15             License along with this library; if not, write to the Free Software
16             Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17            
18             Author: lex.borisov@gmail.com (Alexander Borisov)
19             */
20              
21             #include "modest/node/serialization.h"
22              
23 0           void modest_node_raw_serialization_declaration(mycss_entry_t* mycss_entry, mycss_declaration_entry_t* decl, mycss_property_type_t property_type, mycore_callback_serialize_f callback, void* context, bool* is_use)
24             {
25 0 0         if(decl == NULL)
26 0           return;
27            
28 0 0         if(is_use && *is_use)
    0          
29 0           callback(" ", 1, context);
30            
31 0           mycss_declaration_serialization_entry_by_type(mycss_entry, decl, property_type, callback, context);
32 0           callback(";", 1, context);
33            
34 0 0         if(is_use && *is_use == false) {
    0          
35 0           *is_use = true;
36             }
37             }
38              
39             //bool modest_node_raw_serialization(mycss_entry_t* mycss_entry, modest_node_t* mnode, mycore_callback_serialize_f callback, void* context)
40             //{
41             // bool is_use = false;
42             //
43             // for(size_t i = 0; i < MyCSS_PROPERTY_TYPE_LAST_ENTRY; i++) {
44             // if(mnode->raw_declaration[i])
45             // modest_node_raw_serialization_declaration(mycss_entry, mnode->raw_declaration[i]->declaration, i, callback, context, &is_use);
46             // }
47             //
48             // return is_use;
49             //}
50              
51 0           void modest_node_raw_serialization_callback(mycore_utils_avl_tree_node_t* node, void* context)
52             {
53 0           modest_node_serialization_context_t *ctx = context;
54            
55 0           modest_style_raw_declaration_t *raw_declr = node->value;
56 0           modest_node_raw_serialization_declaration(ctx->modest->mycss_entry, raw_declr->declaration, (mycss_property_type_t)node->type, ctx->callback, ctx->context, &ctx->is_use);
57 0           }
58              
59 0           bool modest_node_raw_serialization(modest_t* modest, modest_node_t* mnode, mycore_callback_serialize_f callback, void* context)
60             {
61 0           modest_node_serialization_context_t ctx = {modest, callback, context, 0};
62            
63 0           mycore_utils_avl_tree_list_all_nodes(modest->style_avl_tree, mnode->avl_tree_node, modest_node_raw_serialization_callback, &ctx);
64            
65 0           return ctx.is_use;
66             }