// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * * Copyright (C) 1999-2014, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: collationweights.h * encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * * created on: 2001mar08 as ucol_wgt.h * created by: Markus W. Scherer */ #ifndef __COLLATIONWEIGHTS_H__ #define __COLLATIONWEIGHTS_H__ #include "unicode/utypes.h" #if !UCONFIG_NO_COLLATION #include "unicode/uobject.h" U_NAMESPACE_BEGIN /** * Allocates n collation element weights between two exclusive limits. * Used only internally by the collation tailoring builder. */ class U_I18N_API CollationWeights : public UMemory { public: CollationWeights(); static inline int32_t lengthOfWeight(uint32_t weight) { if((weight&0xffffff)==0) { return 1; } else if((weight&0xffff)==0) { return 2; } else if((weight&0xff)==0) { return 3; } else { return 4; } } void initForPrimary(UBool compressible); void initForSecondary(); void initForTertiary(); /** * Determine heuristically * what ranges to use for a given number of weights between (excluding) * two limits. * * @param lowerLimit A collation element weight; the ranges will be filled to cover * weights greater than this one. * @param upperLimit A collation element weight; the ranges will be filled to cover * weights less than this one. * @param n The number of collation element weights w necessary such that * lowerLimit