Added function mycss_entry_selectors for get selectors object from mycss entry https://github.com/lexborisov/Modest/issues/3#issuecomment-261920007

This commit is contained in:
lexborisov 2016-11-21 15:18:31 +03:00
parent 58dcf7ec02
commit 61741ce6c5
4 changed files with 15 additions and 3 deletions

View File

@ -80,7 +80,7 @@ int main(int argc, const char * argv[])
mycss_status_t out_status; mycss_status_t out_status;
modest_finder_t *finder = modest_finder_create_simple(html_tree, NULL); modest_finder_t *finder = modest_finder_create_simple(html_tree, NULL);
mycss_selectors_list_t *list = mycss_selectors_parse(css_entry->selectors, MyHTML_ENCODING_UTF_8, selector, strlen(selector), &out_status); mycss_selectors_list_t *list = mycss_selectors_parse(mycss_entry_selectors(css_entry), MyHTML_ENCODING_UTF_8, selector, strlen(selector), &out_status);
myhtml_collection_t *collection = modest_finder_by_selectors_list(finder, list, html_tree->node_html, NULL); myhtml_collection_t *collection = modest_finder_by_selectors_list(finder, list, html_tree->node_html, NULL);
@ -90,7 +90,7 @@ int main(int argc, const char * argv[])
fprintf(stdout, "\n"); fprintf(stdout, "\n");
fprintf(stdout, "Selector:\n\t"); fprintf(stdout, "Selector:\n\t");
mycss_selectors_serialization_list(css_entry->selectors, list, serialization_callback, NULL); mycss_selectors_serialization_list(mycss_entry_selectors(css_entry), list, serialization_callback, NULL);
fprintf(stdout, "\n"); fprintf(stdout, "\n");
printf("\nFound result:\n"); printf("\nFound result:\n");
@ -101,7 +101,7 @@ int main(int argc, const char * argv[])
fprintf(stdout, "\n"); fprintf(stdout, "\n");
// destroy all // destroy all
mycss_selectors_list_destroy(css_entry->selectors, list, true); mycss_selectors_list_destroy(mycss_entry_selectors(css_entry), list, true);
myhtml_collection_destroy(collection); myhtml_collection_destroy(collection);
/* destroy Modest finder */ /* destroy Modest finder */

View File

@ -119,6 +119,9 @@ mycss_entry_t * mycss_entry_destroy(mycss_entry_t* entry, bool self_destroy);
void mycss_entry_end(mycss_entry_t* entry); void mycss_entry_end(mycss_entry_t* entry);
/* api */
mycss_selectors_t * mycss_entry_selectors(mycss_entry_t* entry);
mycss_token_ready_callback_f mycss_entry_token_ready_callback(mycss_entry_t* entry, mycss_token_ready_callback_f callback_f); mycss_token_ready_callback_f mycss_entry_token_ready_callback(mycss_entry_t* entry, mycss_token_ready_callback_f callback_f);
size_t mycss_entry_token_count(mycss_entry_t* entry); size_t mycss_entry_token_count(mycss_entry_t* entry);

View File

@ -206,6 +206,12 @@ void mycss_entry_end(mycss_entry_t* entry)
/* need some code */ /* need some code */
} }
/* api */
mycss_selectors_t * mycss_entry_selectors(mycss_entry_t* entry)
{
return entry->selectors;
}
myhtml_string_t * mycss_entry_string_create_and_init(mycss_entry_t* entry, size_t string_size) myhtml_string_t * mycss_entry_string_create_and_init(mycss_entry_t* entry, size_t string_size)
{ {
myhtml_string_t *str = mcobject_malloc(entry->mcobject_string_entries, NULL); myhtml_string_t *str = mcobject_malloc(entry->mcobject_string_entries, NULL);

View File

@ -119,6 +119,9 @@ mycss_entry_t * mycss_entry_destroy(mycss_entry_t* entry, bool self_destroy);
void mycss_entry_end(mycss_entry_t* entry); void mycss_entry_end(mycss_entry_t* entry);
/* api */
mycss_selectors_t * mycss_entry_selectors(mycss_entry_t* entry);
mycss_token_ready_callback_f mycss_entry_token_ready_callback(mycss_entry_t* entry, mycss_token_ready_callback_f callback_f); mycss_token_ready_callback_f mycss_entry_token_ready_callback(mycss_entry_t* entry, mycss_token_ready_callback_f callback_f);
size_t mycss_entry_token_count(mycss_entry_t* entry); size_t mycss_entry_token_count(mycss_entry_t* entry);