added function mycss_units_name_by_type

This commit is contained in:
lexborisov 2016-08-29 01:56:42 +04:00
parent 37fe46a3a6
commit 8877f02eb6
4 changed files with 9 additions and 0 deletions

View File

@ -86,6 +86,7 @@ typedef mycss_units_index_static_entry_t;
mycss_units_type_t mycss_units_type_by_name(const char *name, size_t length); mycss_units_type_t mycss_units_type_by_name(const char *name, size_t length);
const mycss_units_index_static_entry_t * mycss_units_index_entry_by_name(const char* name, size_t length); const mycss_units_index_static_entry_t * mycss_units_index_entry_by_name(const char* name, size_t length);
const char * mycss_units_name_by_type(mycss_units_type_t unit_type);
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */

View File

@ -64,4 +64,11 @@ mycss_units_type_t mycss_units_type_by_name(const char *name, size_t length)
return MyCSS_UNIT_TYPE_UNDEF; return MyCSS_UNIT_TYPE_UNDEF;
} }
const char * mycss_units_name_by_type(mycss_units_type_t unit_type)
{
if(unit_type >= MyCSS_UNIT_TYPE_LAST_ENTRY)
return NULL;
return mycss_units_index_name[unit_type];
}

View File

@ -86,6 +86,7 @@ typedef mycss_units_index_static_entry_t;
mycss_units_type_t mycss_units_type_by_name(const char *name, size_t length); mycss_units_type_t mycss_units_type_by_name(const char *name, size_t length);
const mycss_units_index_static_entry_t * mycss_units_index_entry_by_name(const char* name, size_t length); const mycss_units_index_static_entry_t * mycss_units_index_entry_by_name(const char* name, size_t length);
const char * mycss_units_name_by_type(mycss_units_type_t unit_type);
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */