]> git.saurik.com Git - apple/icu.git/blame - icuSources/i18n/ucol_wgt.h
ICU-6.2.22.tar.gz
[apple/icu.git] / icuSources / i18n / ucol_wgt.h
CommitLineData
b75a7d8f
A
1/*
2*******************************************************************************
3*
4* Copyright (C) 1999-2001, International Business Machines
5* Corporation and others. All Rights Reserved.
6*
7*******************************************************************************
8* file name: ucol_wgt.h
9* encoding: US-ASCII
10* tab size: 8 (not used)
11* indentation:4
12*
13* created on: 2001mar08
14* created by: Markus W. Scherer
15*/
16
17#ifndef UCOL_WGT_H
18#define UCOL_WGT_H
19
20#include "unicode/utypes.h"
21
22#if !UCONFIG_NO_COLLATION
23
24#include "ucol_imp.h"
25
26/* definitions for CE weights */
27
28typedef struct WeightRange {
29 uint32_t start, end;
30 int32_t length, count;
31 int32_t length2;
32 uint32_t count2;
33} WeightRange;
34
35/**
36 * Determine heuristically
37 * what ranges to use for a given number of weights between (excluding)
38 * two limits.
39 *
40 * @param lowerLimit A collation element weight; the ranges will be filled to cover
41 * weights greater than this one.
42 * @param upperLimit A collation element weight; the ranges will be filled to cover
43 * weights less than this one.
44 * @param n The number of collation element weights w necessary such that
45 * lowerLimit<w<upperLimit in lexical order.
46 * @param maxByte The highest valid byte value.
47 * @param ranges An array that is filled in with one or more ranges to cover
48 * n weights between the limits.
49 * @return number of ranges, 0 if it is not possible to fit n elements between the limits
50 */
51U_CFUNC int32_t
52ucol_allocWeights(uint32_t lowerLimit, uint32_t upperLimit,
53 uint32_t n,
54 uint32_t maxByte,
55 WeightRange ranges[7]);
56
57/**
58 * Given a set of ranges calculated by ucol_allocWeights(),
59 * iterate through the weights.
60 * The ranges are modified to keep the current iteration state.
61 *
62 * @param ranges The array of ranges that ucol_allocWeights() filled in.
63 * The ranges are modified.
64 * @param pRangeCount The number of ranges. It will be decremented when necessary.
65 * @return The next weight in the ranges, or 0xffffffff if there is none left.
66 */
67U_CFUNC uint32_t
68ucol_nextWeight(WeightRange ranges[], int32_t *pRangeCount);
69
70#endif /* #if !UCONFIG_NO_COLLATION */
71
72#endif