File Coverage

third_party/modest/source/mycss/property/serialization.c
Criterion Covered Total %
statement 0 29 0.0
branch 0 8 0.0
condition n/a
subroutine n/a
pod n/a
total 0 37 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 "mycss/property/serialization.h"
22             #include "mycss/property/resources_name.h"
23              
24 0           void mycss_property_serialization_type_name(mycss_property_type_t prop_type, mycore_callback_serialize_f callback, void* context)
25             {
26 0 0         if(prop_type >= MyCSS_PROPERTY_TYPE_LAST_ENTRY)
27 0           return;
28            
29 0           const char* name = mycss_property_index_type_name[prop_type];
30 0           callback(name, strlen(name), context);
31             }
32              
33 0           void mycss_property_serialization_value(unsigned int value_type, void* value, mycore_callback_serialize_f callback, void* context)
34             {
35 0 0         if(value == NULL) {
36 0 0         if(value_type < MyCSS_PROPERTY_VALUE_LAST_ENTRY) {
37 0           const char* text_value = mycss_property_index_type_value[value_type];
38 0           callback(text_value, strlen(text_value), context);
39             }
40            
41 0           return;
42             }
43            
44 0           switch (value_type) {
45             case MyCSS_PROPERTY_VALUE__LENGTH:
46 0           mycss_values_serialization_length(value, callback, context);
47 0           break;
48            
49             case MyCSS_PROPERTY_VALUE__NUMBER:
50 0           mycss_values_serialization_length(value, callback, context);
51 0           break;
52            
53             case MyCSS_PROPERTY_VALUE__PERCENTAGE:
54 0           mycss_values_serialization_percentage(value, callback, context);
55 0           break;
56            
57             case MyCSS_PROPERTY_VALUE__COLOR:
58 0           mycss_values_serialization_color(value, callback, context);
59 0           break;
60            
61             case MyCSS_PROPERTY_VALUE__IMAGE:
62 0           mycss_values_serialization_image(value, callback, context);
63 0           break;
64            
65             case MyCSS_PROPERTY_VALUE__URL:
66 0           mycss_values_serialization_url(value, callback, context);
67 0           break;
68            
69             default:
70             {
71 0 0         if(value_type >= MyCSS_PROPERTY_VALUE_LAST_ENTRY)
72 0           break;
73            
74 0           const char* text_value = mycss_property_index_type_value[value_type];
75 0           callback(text_value, strlen(text_value), context);
76            
77 0           break;
78             }
79             }
80             }
81              
82