1 /* 2 * libwbxml, the WBXML Library. 3 * Copyright (C) 2002-2008 Aymerick Jehanne <aymerick@jehanne.org> 4 * Copyright (C) 2011 Michael Bell <michael.bell@opensync.org> 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 * 20 * LGPL v2.1: http://www.gnu.org/copyleft/lesser.txt 21 * 22 * Contact: aymerick@jehanne.org 23 * Home: http://libwbxml.aymerick.com 24 */ 25 26 /** 27 * @file wbxml_handlers.h 28 * @ingroup wbxml_parser 29 * 30 * @author Aymerick Jehanne <aymerick@jehanne.org> 31 * @date 02/06/09 32 * 33 * @brief WBXML Parser Handlers 34 */ 35 36 #ifndef WBXML_HANDLERS_H 37 #define WBXML_HANDLERS_H 38 39 #include "wbxml.h" 40 #include "wbxml_tables.h" 41 #include "wbxml_elt.h" 42 43 #ifdef __cplusplus 44 extern "C" { 45 #endif /* __cplusplus */ 46 47 /** @addtogroup wbxml_parser 48 * @{ 49 */ 50 51 /** 52 * @brief Start Document Handler 53 * @param ctx User data 54 * @param charset Charset (The MIBenum from IANA character-sets assignements. See "http://www.iana.org/assignments/character-sets") 55 * @param lang Language Table for this Document (cf: wbxml_table.[h|c]) 56 */ 57 typedef void (*WBXMLStartDocumentHandler)(void *ctx, WBXMLCharsetMIBEnum charset, const WBXMLLangEntry *lang); 58 59 /** 60 * @brief End Document handler 61 * @param ctx User data 62 */ 63 typedef void (*WBXMLEndDocumentHandler)(void *ctx); 64 65 /** 66 * @brief Start Element handler 67 * @param ctx User data 68 * @param localName The local tag name 69 * @param atts The attributes attached to the element 70 * @param empty Set to TRUE if this is an empty element 71 */ 72 typedef void (*WBXMLStartElementHandler)(void *ctx, WBXMLTag *localName, WBXMLAttribute **atts); 73 74 /** 75 * @brief End Element handler 76 * @param ctx User data 77 * @param localName The local tag name 78 * @param empty Set to TRUE if this is an empty element 79 */ 80 typedef void (*WBXMLEndElementHandler)(void *ctx, WBXMLTag *localName); 81 82 /** 83 * @brief Characters handler 84 * @param ctx User data 85 * @param ch The characters 86 * @param start The start position in the array 87 * @param length The number of characters to read from the array 88 */ 89 typedef void (*WBXMLCharactersHandler)(void *ctx, WB_UTINY *ch, WB_ULONG start, WB_ULONG length); 90 91 /** 92 * @brief Processing Instruction Handler 93 * @param ctx User data 94 * @param target The processing instruction target. 95 * @param data The processing instruction data, or null if none was supplied. The data does 96 * not include any whitespace separating it from the target 97 */ 98 typedef void (*WBXMLProcessingInstructionHandler)(void *ctx, const WB_UTINY *target, WB_UTINY *data); 99 100 /** 101 * @brief WBXMLContentHandler structure 102 */ 103 typedef struct WBXMLContentHandler_s { 104 WBXMLStartDocumentHandler start_document_clb; /**< Start Document Handler */ 105 WBXMLEndDocumentHandler end_document_clb; /**< End Document handler */ 106 WBXMLStartElementHandler start_element_clb; /**< Start Element handler */ 107 WBXMLEndElementHandler end_element_clb; /**< End Element handler */ 108 WBXMLCharactersHandler characters_clb; /**< Characters handler */ 109 WBXMLProcessingInstructionHandler pi_clb; /**< Processing Instruction Handler */ 110 } WBXMLContentHandler; 111 112 /** @} */ 113 114 #ifdef __cplusplus 115 } 116 #endif /* __cplusplus */ 117 118 #endif /* WBXML_HANDLERS_H */ 119