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