Update ooo320-m1
[ooovba.git] / sal / textenc / convertsinglebytetobmpunicode.hxx
blob96f0eb1c47d326dfb0de61ca4e2faa58bc2708af
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: convertsinglebytetobmpunicode.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef INCLUDED_sal_textenc_convertsinglebytetobmpunicode_hxx
32 #define INCLUDED_sal_textenc_convertsinglebytetobmpunicode_hxx
34 #include "tenchelp.h"
36 #include "sal/types.h"
38 #include <cstddef>
40 /// @HTML
42 namespace rtl { namespace textenc {
44 /**
45 Maps a range of BMP Unicode code points to individual bytes.
47 @see rtl::textenc::BmpUnicodeToSingleByteConverterData
49 struct BmpUnicodeToSingleByteRange {
50 /**
51 The start of the range of BMP Unicode code points.
53 sal_Unicode unicode;
55 /**
56 The extend of the range of BMP Unicode code points.
58 <p>The range covers <code>unicode</code> to <code>unicode + range</code>,
59 inclusive. It is an error if <code>unicode + range</code> is greater
60 than <code>0xFFFF</code>.</p>
62 sal_uInt8 range;
64 /**
65 The start of the corresponding range of individual bytes.
67 <p>It is an error if <code>byte + range</code> is greater than
68 <code>0xFF</code>.</p>
70 sal_uInt8 byte;
73 /**
74 Data to convert between BMP Unicode and a single-byte character set.
76 <p>Only supports conversions where each legal unit from the single-byte
77 character set has one or more mappings to individual BMP Unicode code points
78 that are neither noncharacters nor surrogates.</p>
80 @see rtl_textenc_convertSingleByteToBmpUnicode
81 @see rtl_textenc_convertBmpUnicodeToSingleByte
83 struct BmpUnicodeToSingleByteConverterData {
84 /**
85 Mapping from the single-byte character set to BMP Unicode code points.
87 <p>Illegal units from the single-byte character set are mapped to
88 <code>0xFFFF</code>.</p>
90 sal_Unicode byteToUnicode[256];
92 /**
93 The number of Unicode-to-byte conversion ranges.
95 std::size_t unicodeToByteEntries;
97 /**
98 The array of Unicode-to-byte conversion ranges, sorted by increasing
99 <code>unicode</code> values.
101 <p>The ranges may not overlap.</p>
103 BmpUnicodeToSingleByteRange const * unicodeToByte;
109 Function to convert from a single-byte character set to BMP Unicode.
111 @see ImplConvertToUnicodeProc
113 extern "C" sal_Size rtl_textenc_convertSingleByteToBmpUnicode(
114 ImplTextConverterData const * data, void * context, sal_Char const * srcBuf,
115 sal_Size srcBytes, sal_Unicode * destBuf, sal_Size destChars,
116 sal_uInt32 flags, sal_uInt32 * info, sal_Size * srcCvtBytes);
119 Function to convert from BMP Unicode to a single-byte character set.
121 @see ImplConvertToTextProc
123 extern "C" sal_Size rtl_textenc_convertBmpUnicodeToSingleByte(
124 ImplTextConverterData const * data, void * context,
125 sal_Unicode const * srcBuf, sal_Size srcChars, sal_Char * destBuf,
126 sal_Size destBytes, sal_uInt32 flags, sal_uInt32 * info,
127 sal_Size * srcCvtChars);
129 #endif