winepulse: Remove AudioSessionManager.
[wine.git] / dlls / xmllite / xmllite_private.h
blobf4e2d92fe26e1e4a3f8eb970b3f968d1940bbb2c
1 /*
2 * XMLLite private things
4 * Copyright 2012 Nikolay Sivov for CodeWeavers
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.
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.
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
21 #ifndef __XMLLITE_PRIVATE__
22 #define __XMLLITE_PRIVATE__
24 static inline void *m_alloc(IMalloc *imalloc, size_t len)
26 if (imalloc)
27 return IMalloc_Alloc(imalloc, len);
28 else
29 return malloc(len);
32 static inline void *m_realloc(IMalloc *imalloc, void *mem, size_t len)
34 if (imalloc)
35 return IMalloc_Realloc(imalloc, mem, len);
36 else
37 return realloc(mem, len);
40 static inline void m_free(IMalloc *imalloc, void *mem)
42 if (imalloc)
43 IMalloc_Free(imalloc, mem);
44 else
45 free(mem);
48 typedef enum
50 XmlEncoding_USASCII,
51 XmlEncoding_UTF16,
52 XmlEncoding_UTF8,
53 XmlEncoding_Unknown
54 } xml_encoding;
56 xml_encoding parse_encoding_name(const WCHAR*,int) DECLSPEC_HIDDEN;
57 HRESULT get_code_page(xml_encoding,UINT*) DECLSPEC_HIDDEN;
58 const WCHAR *get_encoding_name(xml_encoding) DECLSPEC_HIDDEN;
59 xml_encoding get_encoding_from_codepage(UINT) DECLSPEC_HIDDEN;
61 BOOL is_ncnamechar(WCHAR ch) DECLSPEC_HIDDEN;
62 BOOL is_pubchar(WCHAR ch) DECLSPEC_HIDDEN;
63 BOOL is_namestartchar(WCHAR ch) DECLSPEC_HIDDEN;
64 BOOL is_namechar(WCHAR ch) DECLSPEC_HIDDEN;
66 /* [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] */
67 static inline BOOL is_char(WCHAR ch)
69 return (ch == '\t') || (ch == '\r') || (ch == '\n') ||
70 (ch >= 0x20 && ch <= 0xd7ff) ||
71 (ch >= 0xd800 && ch <= 0xdbff) || /* high surrogate */
72 (ch >= 0xdc00 && ch <= 0xdfff) || /* low surrogate */
73 (ch >= 0xe000 && ch <= 0xfffd);
76 /* [3] S ::= (#x20 | #x9 | #xD | #xA)+ */
77 static inline BOOL is_wchar_space(WCHAR ch)
79 return ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n';
82 #endif /* __XMLLITE_PRIVATE__ */