xref: /aosp_15_r20/external/icu/libicu/cts_headers/collationdatawriter.h (revision 0e209d3975ff4a8c132096b14b0e9364a753506e)
1*0e209d39SAndroid Build Coastguard Worker // © 2016 and later: Unicode, Inc. and others.
2*0e209d39SAndroid Build Coastguard Worker // License & terms of use: http://www.unicode.org/copyright.html
3*0e209d39SAndroid Build Coastguard Worker /*
4*0e209d39SAndroid Build Coastguard Worker *******************************************************************************
5*0e209d39SAndroid Build Coastguard Worker * Copyright (C) 2013-2014, International Business Machines
6*0e209d39SAndroid Build Coastguard Worker * Corporation and others.  All Rights Reserved.
7*0e209d39SAndroid Build Coastguard Worker *******************************************************************************
8*0e209d39SAndroid Build Coastguard Worker * collationdatawriter.h
9*0e209d39SAndroid Build Coastguard Worker *
10*0e209d39SAndroid Build Coastguard Worker * created on: 2013aug06
11*0e209d39SAndroid Build Coastguard Worker * created by: Markus W. Scherer
12*0e209d39SAndroid Build Coastguard Worker */
13*0e209d39SAndroid Build Coastguard Worker 
14*0e209d39SAndroid Build Coastguard Worker #ifndef __COLLATIONDATAWRITER_H__
15*0e209d39SAndroid Build Coastguard Worker #define __COLLATIONDATAWRITER_H__
16*0e209d39SAndroid Build Coastguard Worker 
17*0e209d39SAndroid Build Coastguard Worker #include "unicode/utypes.h"
18*0e209d39SAndroid Build Coastguard Worker 
19*0e209d39SAndroid Build Coastguard Worker #if !UCONFIG_NO_COLLATION
20*0e209d39SAndroid Build Coastguard Worker 
21*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_BEGIN
22*0e209d39SAndroid Build Coastguard Worker 
23*0e209d39SAndroid Build Coastguard Worker struct CollationData;
24*0e209d39SAndroid Build Coastguard Worker struct CollationSettings;
25*0e209d39SAndroid Build Coastguard Worker struct CollationTailoring;
26*0e209d39SAndroid Build Coastguard Worker 
27*0e209d39SAndroid Build Coastguard Worker /**
28*0e209d39SAndroid Build Coastguard Worker  * Collation-related code for tools & demos.
29*0e209d39SAndroid Build Coastguard Worker  */
30*0e209d39SAndroid Build Coastguard Worker class U_I18N_API CollationDataWriter /* all static */ {
31*0e209d39SAndroid Build Coastguard Worker public:
32*0e209d39SAndroid Build Coastguard Worker     static int32_t writeBase(const CollationData &data, const CollationSettings &settings,
33*0e209d39SAndroid Build Coastguard Worker                              const void *rootElements, int32_t rootElementsLength,
34*0e209d39SAndroid Build Coastguard Worker                              int32_t indexes[], uint8_t *dest, int32_t capacity,
35*0e209d39SAndroid Build Coastguard Worker                              UErrorCode &errorCode);
36*0e209d39SAndroid Build Coastguard Worker 
37*0e209d39SAndroid Build Coastguard Worker     static int32_t writeTailoring(const CollationTailoring &t, const CollationSettings &settings,
38*0e209d39SAndroid Build Coastguard Worker                                   int32_t indexes[], uint8_t *dest, int32_t capacity,
39*0e209d39SAndroid Build Coastguard Worker                                   UErrorCode &errorCode);
40*0e209d39SAndroid Build Coastguard Worker 
41*0e209d39SAndroid Build Coastguard Worker private:
42*0e209d39SAndroid Build Coastguard Worker     CollationDataWriter() = delete;  // no constructor
43*0e209d39SAndroid Build Coastguard Worker 
44*0e209d39SAndroid Build Coastguard Worker     static int32_t write(UBool isBase, const UVersionInfo dataVersion,
45*0e209d39SAndroid Build Coastguard Worker                          const CollationData &data, const CollationSettings &settings,
46*0e209d39SAndroid Build Coastguard Worker                          const void *rootElements, int32_t rootElementsLength,
47*0e209d39SAndroid Build Coastguard Worker                          int32_t indexes[], uint8_t *dest, int32_t capacity,
48*0e209d39SAndroid Build Coastguard Worker                          UErrorCode &errorCode);
49*0e209d39SAndroid Build Coastguard Worker 
50*0e209d39SAndroid Build Coastguard Worker     static void copyData(const int32_t indexes[], int32_t startIndex,
51*0e209d39SAndroid Build Coastguard Worker                          const void *src, uint8_t *dest);
52*0e209d39SAndroid Build Coastguard Worker };
53*0e209d39SAndroid Build Coastguard Worker 
54*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_END
55*0e209d39SAndroid Build Coastguard Worker 
56*0e209d39SAndroid Build Coastguard Worker #endif  // !UCONFIG_NO_COLLATION
57*0e209d39SAndroid Build Coastguard Worker #endif  // __COLLATIONDATAWRITER_H__
58