sc: fix crash in SdrPageView::GetPageWindow()
[LibreOffice.git] / sal / textenc / convertsinglebytetobmpunicode.hxx
blobbd657bbca723eeff640c2fb282011f8923df230a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
25 #include <cstddef>
27 #include <sal/types.h>
30 /// @HTML
32 namespace rtl::textenc {
34 /**
35 Maps a range of BMP Unicode code points to individual bytes.
37 @see rtl::textenc::BmpUnicodeToSingleByteConverterData
39 struct BmpUnicodeToSingleByteRange {
40 /**
41 The start of the range of BMP Unicode code points.
43 sal_Unicode unicode;
45 /**
46 The extend of the range of BMP Unicode code points.
48 <p>The range covers <code>unicode</code> to <code>unicode + range</code>,
49 inclusive. It is an error if <code>unicode + range</code> is greater
50 than <code>0xFFFF</code>.</p>
52 sal_uInt8 range;
54 /**
55 The start of the corresponding range of individual bytes.
57 <p>It is an error if <code>byte + range</code> is greater than
58 <code>0xFF</code>.</p>
60 sal_uInt8 byte;
63 /**
64 Data to convert between BMP Unicode and a single-byte character set.
66 <p>Only supports conversions where each legal unit from the single-byte
67 character set has one or more mappings to individual BMP Unicode code points
68 that are neither noncharacters nor surrogates.</p>
70 @see rtl_textenc_convertSingleByteToBmpUnicode
71 @see rtl_textenc_convertBmpUnicodeToSingleByte
73 struct BmpUnicodeToSingleByteConverterData {
74 /**
75 Mapping from the single-byte character set to BMP Unicode code points.
77 <p>Illegal units from the single-byte character set are mapped to
78 <code>0xFFFF</code>.</p>
80 sal_Unicode byteToUnicode[256];
82 /**
83 The number of Unicode-to-byte conversion ranges.
85 std::size_t unicodeToByteEntries;
87 /**
88 The array of Unicode-to-byte conversion ranges, sorted by increasing
89 <code>unicode</code> values.
91 <p>The ranges may not overlap.</p>
93 BmpUnicodeToSingleByteRange const * unicodeToByte;
98 /**
99 Function to convert from a single-byte character set to BMP Unicode.
101 @see ImplConvertToUnicodeProc
103 sal_Size rtl_textenc_convertSingleByteToBmpUnicode(
104 void const * data, void * context, char const * srcBuf,
105 sal_Size srcBytes, sal_Unicode * destBuf, sal_Size destChars,
106 sal_uInt32 flags, sal_uInt32 * info, sal_Size * srcCvtBytes);
109 Function to convert from BMP Unicode to a single-byte character set.
111 @see ImplConvertToTextProc
113 sal_Size rtl_textenc_convertBmpUnicodeToSingleByte(
114 void const * data, void * context,
115 sal_Unicode const * srcBuf, sal_Size srcChars, char * destBuf,
116 sal_Size destBytes, sal_uInt32 flags, sal_uInt32 * info,
117 sal_Size * srcCvtChars);
119 #endif
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */