File Coverage

third_party/modest/source/mycss/values/image.c
Criterion Covered Total %
statement 0 35 0.0
branch 0 12 0.0
condition n/a
subroutine n/a
pod n/a
total 0 47 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/values/image.h"
22             #include "mycss/values/image_resources.h"
23             #include "mycore/utils/resources.h"
24              
25 0           const mycss_values_image_function_index_static_entry_t * mycss_values_image_index_entry_by_name(const char* name, size_t length)
26             {
27 0           size_t idx = ((mycore_string_chars_lowercase_map[ (const unsigned char)name[0] ] *
28 0           mycore_string_chars_lowercase_map[ (const unsigned char)name[(length - 1)] ] *
29             length)
30 0           % MyCSS_IMAGE_FUNCTION_STATIC_INDEX_FOR_SEARCH_SIZE) + 1;
31            
32 0 0         while (mycss_values_image_function_index_static_for_search[idx].name)
33             {
34 0 0         if(mycss_values_image_function_index_static_for_search[idx].name_length == length) {
35 0 0         if(mycore_strncasecmp(mycss_values_image_function_index_static_for_search[idx].name, name, length) == 0)
36 0           return &mycss_values_image_function_index_static_for_search[idx];
37            
38 0 0         if(mycss_values_image_function_index_static_for_search[idx].next)
39 0           idx = mycss_values_image_function_index_static_for_search[idx].next;
40             else
41 0           return NULL;
42             }
43 0 0         else if(mycss_values_image_function_index_static_for_search[idx].name_length > length) {
44 0           return NULL;
45             }
46             else {
47 0           idx = mycss_values_image_function_index_static_for_search[idx].next;
48             }
49             }
50            
51 0           return NULL;
52             }
53              
54 0           mycss_property_value_t mycss_values_image_id_by_name(const char *name, size_t length)
55             {
56 0           const mycss_values_image_function_index_static_entry_t *entry = mycss_values_image_index_entry_by_name(name, length);
57            
58 0 0         if(entry)
59 0           return entry->type;
60            
61 0           return MyCSS_PROPERTY_VALUE_UNDEF;
62             }
63              
64 0           void * mycss_values_image_creator_url(mycss_entry_t* entry, mycss_values_image_t* image)
65             {
66 0           image->value.url = mycss_values_create(entry, sizeof(mycss_values_url_t));
67 0           return image->value.url;
68             }
69              
70 0           void * mycss_values_image_creator_function_image(mycss_entry_t* entry, mycss_values_image_t* image)
71             {
72 0           image->value.ii = mycss_values_create(entry, sizeof(mycss_values_image_image_t));
73 0           return image->value.ii;
74             }
75              
76 0           void * mycss_values_image_creator_image_set(mycss_entry_t* entry, mycss_values_image_t* image)
77             {
78 0           image->value.ii_set = mycss_values_create(entry, sizeof(mycss_values_image_image_set_t));
79 0           return image->value.ii_set;
80             }
81              
82 0           void * mycss_values_image_creator_element(mycss_entry_t* entry, mycss_values_image_t* image)
83             {
84 0           image->value.element = mycss_values_create(entry, sizeof(mycss_values_element_t));
85 0           return image->value.element;
86             }
87              
88 0           void * mycss_values_image_creator_cross_fade(mycss_entry_t* entry, mycss_values_image_t* image)
89             {
90 0           image->value.cross_fade = mycss_values_create(entry, sizeof(mycss_values_cross_fade_t));
91 0           return image->value.cross_fade;
92             }
93              
94