xref: /freebsd/contrib/expat/tests/chardata.h (revision bc7512cc58af2e8bbe5bbf5ca0059b1daa1da897)
1 /* Interface to some helper routines used to accumulate and check text
2    and attribute content.
3                             __  __            _
4                          ___\ \/ /_ __   __ _| |_
5                         / _ \\  /| '_ \ / _` | __|
6                        |  __//  \| |_) | (_| | |_
7                         \___/_/\_\ .__/ \__,_|\__|
8                                  |_| XML parser
9 
10    Copyright (c) 2002-2004 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
11    Copyright (c) 2017      Rhodri James <rhodri@wildebeest.org.uk>
12    Copyright (c) 2017      Sebastian Pipping <sebastian@pipping.org>
13    Licensed under the MIT license:
14 
15    Permission is  hereby granted,  free of charge,  to any  person obtaining
16    a  copy  of  this  software   and  associated  documentation  files  (the
17    "Software"),  to  deal in  the  Software  without restriction,  including
18    without  limitation the  rights  to use,  copy,  modify, merge,  publish,
19    distribute, sublicense, and/or sell copies of the Software, and to permit
20    persons  to whom  the Software  is  furnished to  do so,  subject to  the
21    following conditions:
22 
23    The above copyright  notice and this permission notice  shall be included
24    in all copies or substantial portions of the Software.
25 
26    THE  SOFTWARE  IS  PROVIDED  "AS  IS",  WITHOUT  WARRANTY  OF  ANY  KIND,
27    EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF
28    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
29    NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
30    DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR
31    OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
32    USE OR OTHER DEALINGS IN THE SOFTWARE.
33 */
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 #ifndef XML_CHARDATA_H
40 #  define XML_CHARDATA_H 1
41 
42 #  ifndef XML_VERSION
43 #    include "expat.h" /* need XML_Char */
44 #  endif
45 
46 typedef struct {
47   int count; /* # of chars, < 0 if not set */
48   XML_Char data[2048];
49 } CharData;
50 
51 void CharData_Init(CharData *storage);
52 
53 void CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len);
54 
55 int CharData_CheckXMLChars(CharData *storage, const XML_Char *s);
56 
57 #endif /* XML_CHARDATA_H */
58 
59 #ifdef __cplusplus
60 }
61 #endif
62