xmllite_private.h 1.96 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
 *    XMLLite private things
 *
 * Copyright 2012 Nikolay Sivov for CodeWeavers
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

#ifndef __XMLLITE_PRIVATE__
#define __XMLLITE_PRIVATE__

24
#include "wine/heap.h"
25

26 27 28 29 30 31 32 33
static inline void *m_alloc(IMalloc *imalloc, size_t len)
{
    if (imalloc)
        return IMalloc_Alloc(imalloc, len);
    else
        return heap_alloc(len);
}

34 35 36 37 38 39 40 41
static inline void *m_realloc(IMalloc *imalloc, void *mem, size_t len)
{
    if (imalloc)
        return IMalloc_Realloc(imalloc, mem, len);
    else
        return heap_realloc(mem, len);
}

42 43 44 45 46 47 48 49 50 51
static inline void m_free(IMalloc *imalloc, void *mem)
{
    if (imalloc)
        IMalloc_Free(imalloc, mem);
    else
        heap_free(mem);
}

typedef enum
{
52
    XmlEncoding_USASCII,
53 54 55 56 57
    XmlEncoding_UTF16,
    XmlEncoding_UTF8,
    XmlEncoding_Unknown
} xml_encoding;

58 59
xml_encoding parse_encoding_name(const WCHAR*,int) DECLSPEC_HIDDEN;
HRESULT get_code_page(xml_encoding,UINT*) DECLSPEC_HIDDEN;
60
const WCHAR *get_encoding_name(xml_encoding) DECLSPEC_HIDDEN;
61
xml_encoding get_encoding_from_codepage(UINT) DECLSPEC_HIDDEN;
62

63
BOOL is_ncnamechar(WCHAR ch) DECLSPEC_HIDDEN;
64 65 66
BOOL is_pubchar(WCHAR ch) DECLSPEC_HIDDEN;
BOOL is_namestartchar(WCHAR ch) DECLSPEC_HIDDEN;
BOOL is_namechar(WCHAR ch) DECLSPEC_HIDDEN;
67

68
#endif /* __XMLLITE_PRIVATE__ */