bstring 1.1.0
Loading...
Searching...
No Matches
buniutil.h
Go to the documentation of this file.
1/* Copyright 2002-2015 Paul Hsieh
2 * This file is part of Bstrlib.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * 3. Neither the name of bstrlib nor the names of its contributors may be
15 * used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 *
30 * Alternatively, the contents of this file may be used under the terms of
31 * GNU General Public License Version 2 (the "GPL").
32 */
33
40
41#ifndef BSTRLIB_UNICODE_UTILITIES
42#define BSTRLIB_UNICODE_UTILITIES
43
44#include "bstrlib.h"
45#include "utf8util.h"
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
55BSTR_PUBLIC int
56buIsUTF8Content(const bstring bu);
57
66BSTR_PUBLIC int
67buAppendBlkUcs4(bstring b, const cpUcs4 *bu, int len, cpUcs4 errCh);
68
69/* For those unfortunate enough to be stuck supporting UTF-16. */
70
78BSTR_PUBLIC int
79buGetBlkUTF16(/* @out */ cpUcs2 *ucs2, int len, cpUcs4 errCh,
80 const bstring bu, int pos);
81
92BSTR_PUBLIC int
93buAppendBlkUTF16(bstring bu, const cpUcs2 *utf16, int len, cpUcs2 *bom,
94 cpUcs4 errCh);
95
96#ifdef __cplusplus
97}
98#endif
99
100#endif /* BSTRLIB_UNICODE_UTILITIES */
C implementaion of bstring functions.
BSTR_PUBLIC int buIsUTF8Content(const bstring bu)
BSTR_PUBLIC int buGetBlkUTF16(cpUcs2 *ucs2, int len, cpUcs4 errCh, const bstring bu, int pos)
BSTR_PUBLIC int buAppendBlkUTF16(bstring bu, const cpUcs2 *utf16, int len, cpUcs2 *bom, cpUcs4 errCh)
BSTR_PUBLIC int buAppendBlkUcs4(bstring b, const cpUcs4 *bu, int len, cpUcs4 errCh)
Interface for low-level UTF-8 utility functions.