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