| 1 | /* | ||
| 2 | Copyright (C) 2015-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 "myhtml/callback.h" | ||
| 22 | |||
| 23 | |||
| 24 | /* callback functions for tokens */ | ||
| 25 | 0 | myhtml_callback_token_f myhtml_callback_before_token_done(myhtml_tree_t *tree) | |
| 26 | { | ||
| 27 | 0 | return tree->callback_before_token; | |
| 28 | } | ||
| 29 | |||
| 30 | 0 | myhtml_callback_token_f myhtml_callback_after_token_done(myhtml_tree_t *tree) | |
| 31 | { | ||
| 32 | 0 | return tree->callback_after_token; | |
| 33 | } | ||
| 34 | |||
| 35 | 0 | void myhtml_callback_before_token_done_set(myhtml_tree_t *tree, myhtml_callback_token_f func, void* ctx) | |
| 36 | { | ||
| 37 | 0 | tree->callback_before_token = func; | |
| 38 | 0 | tree->callback_before_token_ctx = ctx; | |
| 39 | 0 | } | |
| 40 | |||
| 41 | 0 | void myhtml_callback_after_token_done_set(myhtml_tree_t *tree, myhtml_callback_token_f func, void* ctx) | |
| 42 | { | ||
| 43 | 0 | tree->callback_after_token = func; | |
| 44 | 0 | tree->callback_after_token_ctx = ctx; | |
| 45 | 0 | } | |
| 46 | |||
| 47 | 0 | myhtml_callback_tree_node_f myhtml_callback_tree_node_insert(myhtml_tree_t *tree) | |
| 48 | { | ||
| 49 | 0 | return tree->callback_tree_node_insert; | |
| 50 | } | ||
| 51 | |||
| 52 | 0 | myhtml_callback_tree_node_f myhtml_callback_tree_node_remove(myhtml_tree_t *tree) | |
| 53 | { | ||
| 54 | 0 | return tree->callback_tree_node_remove; | |
| 55 | } | ||
| 56 | |||
| 57 | 0 | void myhtml_callback_tree_node_insert_set(myhtml_tree_t *tree, myhtml_callback_tree_node_f func, void* ctx) | |
| 58 | { | ||
| 59 | 0 | tree->callback_tree_node_insert = func; | |
| 60 | 0 | tree->callback_tree_node_insert_ctx = ctx; | |
| 61 | 0 | } | |
| 62 | |||
| 63 | 0 | void myhtml_callback_tree_node_remove_set(myhtml_tree_t *tree, myhtml_callback_tree_node_f func, void* ctx) | |
| 64 | { | ||
| 65 | 0 | tree->callback_tree_node_remove = func; | |
| 66 | 0 | tree->callback_tree_node_remove_ctx = ctx; | |
| 67 | 0 | } | |
| 68 | |||
| 69 |