1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef INCLUDED_sal_textenc_convertsinglebytetobmpunicode_hxx
30 #define INCLUDED_sal_textenc_convertsinglebytetobmpunicode_hxx
34 #include "sal/types.h"
40 namespace rtl
{ namespace textenc
{
43 Maps a range of BMP Unicode code points to individual bytes.
45 @see rtl::textenc::BmpUnicodeToSingleByteConverterData
47 struct BmpUnicodeToSingleByteRange
{
49 The start of the range of BMP Unicode code points.
54 The extend of the range of BMP Unicode code points.
56 <p>The range covers <code>unicode</code> to <code>unicode + range</code>,
57 inclusive. It is an error if <code>unicode + range</code> is greater
58 than <code>0xFFFF</code>.</p>
63 The start of the corresponding range of individual bytes.
65 <p>It is an error if <code>byte + range</code> is greater than
66 <code>0xFF</code>.</p>
72 Data to convert between BMP Unicode and a single-byte character set.
74 <p>Only supports conversions where each legal unit from the single-byte
75 character set has one or more mappings to individual BMP Unicode code points
76 that are neither noncharacters nor surrogates.</p>
78 @see rtl_textenc_convertSingleByteToBmpUnicode
79 @see rtl_textenc_convertBmpUnicodeToSingleByte
81 struct BmpUnicodeToSingleByteConverterData
{
83 Mapping from the single-byte character set to BMP Unicode code points.
85 <p>Illegal units from the single-byte character set are mapped to
86 <code>0xFFFF</code>.</p>
88 sal_Unicode byteToUnicode
[256];
91 The number of Unicode-to-byte conversion ranges.
93 std::size_t unicodeToByteEntries
;
96 The array of Unicode-to-byte conversion ranges, sorted by increasing
97 <code>unicode</code> values.
99 <p>The ranges may not overlap.</p>
101 BmpUnicodeToSingleByteRange
const * unicodeToByte
;
107 Function to convert from a single-byte character set to BMP Unicode.
109 @see ImplConvertToUnicodeProc
111 extern "C" sal_Size
rtl_textenc_convertSingleByteToBmpUnicode(
112 ImplTextConverterData
const * data
, void * context
, sal_Char
const * srcBuf
,
113 sal_Size srcBytes
, sal_Unicode
* destBuf
, sal_Size destChars
,
114 sal_uInt32 flags
, sal_uInt32
* info
, sal_Size
* srcCvtBytes
);
117 Function to convert from BMP Unicode to a single-byte character set.
119 @see ImplConvertToTextProc
121 extern "C" sal_Size
rtl_textenc_convertBmpUnicodeToSingleByte(
122 ImplTextConverterData
const * data
, void * context
,
123 sal_Unicode
const * srcBuf
, sal_Size srcChars
, sal_Char
* destBuf
,
124 sal_Size destBytes
, sal_uInt32 flags
, sal_uInt32
* info
,
125 sal_Size
* srcCvtChars
);
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */