1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SAL_TEXTENC_CONVERTSINGLEBYTETOBMPUNICODE_HXX
21 #define INCLUDED_SAL_TEXTENC_CONVERTSINGLEBYTETOBMPUNICODE_HXX
23 #include "sal/config.h"
27 #include "sal/types.h"
29 #include "tenchelp.hxx"
33 namespace rtl
{ namespace textenc
{
36 Maps a range of BMP Unicode code points to individual bytes.
38 @see rtl::textenc::BmpUnicodeToSingleByteConverterData
40 struct BmpUnicodeToSingleByteRange
{
42 The start of the range of BMP Unicode code points.
47 The extend of the range of BMP Unicode code points.
49 <p>The range covers <code>unicode</code> to <code>unicode + range</code>,
50 inclusive. It is an error if <code>unicode + range</code> is greater
51 than <code>0xFFFF</code>.</p>
56 The start of the corresponding range of individual bytes.
58 <p>It is an error if <code>byte + range</code> is greater than
59 <code>0xFF</code>.</p>
65 Data to convert between BMP Unicode and a single-byte character set.
67 <p>Only supports conversions where each legal unit from the single-byte
68 character set has one or more mappings to individual BMP Unicode code points
69 that are neither noncharacters nor surrogates.</p>
71 @see rtl_textenc_convertSingleByteToBmpUnicode
72 @see rtl_textenc_convertBmpUnicodeToSingleByte
74 struct BmpUnicodeToSingleByteConverterData
{
76 Mapping from the single-byte character set to BMP Unicode code points.
78 <p>Illegal units from the single-byte character set are mapped to
79 <code>0xFFFF</code>.</p>
81 sal_Unicode byteToUnicode
[256];
84 The number of Unicode-to-byte conversion ranges.
86 std::size_t unicodeToByteEntries
;
89 The array of Unicode-to-byte conversion ranges, sorted by increasing
90 <code>unicode</code> values.
92 <p>The ranges may not overlap.</p>
94 BmpUnicodeToSingleByteRange
const * unicodeToByte
;
100 Function to convert from a single-byte character set to BMP Unicode.
102 @see ImplConvertToUnicodeProc
104 sal_Size
rtl_textenc_convertSingleByteToBmpUnicode(
105 void const * data
, void * context
, sal_Char
const * srcBuf
,
106 sal_Size srcBytes
, sal_Unicode
* destBuf
, sal_Size destChars
,
107 sal_uInt32 flags
, sal_uInt32
* info
, sal_Size
* srcCvtBytes
);
110 Function to convert from BMP Unicode to a single-byte character set.
112 @see ImplConvertToTextProc
114 sal_Size
rtl_textenc_convertBmpUnicodeToSingleByte(
115 void const * data
, void * context
,
116 sal_Unicode
const * srcBuf
, sal_Size srcChars
, sal_Char
* destBuf
,
117 sal_Size destBytes
, sal_uInt32 flags
, sal_uInt32
* info
,
118 sal_Size
* srcCvtChars
);
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */