12e5b6d6dSopenharmony_ci// © 2017 and later: Unicode, Inc. and others. 22e5b6d6dSopenharmony_ci// License & terms of use: http://www.unicode.org/copyright.html 32e5b6d6dSopenharmony_ci/* 42e5b6d6dSopenharmony_ci******************************************************************************* 52e5b6d6dSopenharmony_ci* 62e5b6d6dSopenharmony_ci* Copyright (C) 2003, International Business Machines 72e5b6d6dSopenharmony_ci* Corporation and others. All Rights Reserved. 82e5b6d6dSopenharmony_ci* 92e5b6d6dSopenharmony_ci******************************************************************************* 102e5b6d6dSopenharmony_ci* 112e5b6d6dSopenharmony_ci* File line.h 122e5b6d6dSopenharmony_ci* 132e5b6d6dSopenharmony_ci* Modification History: 142e5b6d6dSopenharmony_ci* 152e5b6d6dSopenharmony_ci* Date Name Description 162e5b6d6dSopenharmony_ci* 07/07/2003 weiv Creation. 172e5b6d6dSopenharmony_ci******************************************************************************* 182e5b6d6dSopenharmony_ci*/ 192e5b6d6dSopenharmony_ci 202e5b6d6dSopenharmony_ci// 212e5b6d6dSopenharmony_ci// class Line 222e5b6d6dSopenharmony_ci// 232e5b6d6dSopenharmony_ci// Each line from the source file (containing a name, presumably) gets 242e5b6d6dSopenharmony_ci// one of these structs. 252e5b6d6dSopenharmony_ci// 262e5b6d6dSopenharmony_ci 272e5b6d6dSopenharmony_ci#ifndef COLPROBE_STRENGTHPROBE_H 282e5b6d6dSopenharmony_ci#define COLPROBE_STRENGTHPROBE_H 292e5b6d6dSopenharmony_ci 302e5b6d6dSopenharmony_ci#include "colprobe.h" 312e5b6d6dSopenharmony_ci#include "line.h" 322e5b6d6dSopenharmony_ci#include "unicode/uniset.h" 332e5b6d6dSopenharmony_ci#include "unicode/usetiter.h" 342e5b6d6dSopenharmony_ci 352e5b6d6dSopenharmony_ciclass StrengthProbe { 362e5b6d6dSopenharmony_cipublic: 372e5b6d6dSopenharmony_ci UChar SE; 382e5b6d6dSopenharmony_ci UChar B0; 392e5b6d6dSopenharmony_ci UChar B1; 402e5b6d6dSopenharmony_ci UChar B2; 412e5b6d6dSopenharmony_ci UChar B3; 422e5b6d6dSopenharmony_ciprivate: 432e5b6d6dSopenharmony_ci Line utilFirst; 442e5b6d6dSopenharmony_ci Line utilSecond; 452e5b6d6dSopenharmony_ci Line *utilFirstP; 462e5b6d6dSopenharmony_ci Line *utilSecondP; 472e5b6d6dSopenharmony_ci Line contractionUtilFirst; 482e5b6d6dSopenharmony_ci Line contractionUtilSecond; 492e5b6d6dSopenharmony_ci UBool probePrefix(const Line &x, const Line &y, UChar first, UChar second); 502e5b6d6dSopenharmony_ci UBool probeSuffix(const Line &x, const Line &y, UChar first, UChar second); 512e5b6d6dSopenharmony_ci UBool probePrefixNoSep(const Line &x, const Line &y, UChar first, UChar second); 522e5b6d6dSopenharmony_ci UBool probeSuffixNoSep(const Line &x, const Line &y, UChar first, UChar second); 532e5b6d6dSopenharmony_ci 542e5b6d6dSopenharmony_ci UBool frenchSecondary; 552e5b6d6dSopenharmony_ci 562e5b6d6dSopenharmony_cipublic: 572e5b6d6dSopenharmony_ci CompareFn comparer; 582e5b6d6dSopenharmony_ci GetSortKeyFn skgetter; 592e5b6d6dSopenharmony_ci 602e5b6d6dSopenharmony_ci StrengthProbe() {}; 612e5b6d6dSopenharmony_ci StrengthProbe(CompareFn comparer, GetSortKeyFn getter, UChar SE = 0x0030, UChar B0 = 0x0061, UChar B1 = 0x0062, UChar B2 = 0x00E1, UChar B3 = 0x0041); //, UChar LB = 0x0039, UChar UB = 0xfa29); 622e5b6d6dSopenharmony_ci int setProbeChars(UChar B0, UChar B1, UChar B2, UChar B3); 632e5b6d6dSopenharmony_ci int checkSanity(); 642e5b6d6dSopenharmony_ci StrengthProbe(const StrengthProbe &that); 652e5b6d6dSopenharmony_ci StrengthProbe &operator=(const StrengthProbe &that); 662e5b6d6dSopenharmony_ci UColAttributeValue getStrength(const Line &x, const Line &y); 672e5b6d6dSopenharmony_ci UColAttributeValue getStrength(const UnicodeString &x, const UnicodeString &y); 682e5b6d6dSopenharmony_ci UColAttributeValue getPrefixedStrength(const Line &prefix, const Line &x, const Line &y); 692e5b6d6dSopenharmony_ci int32_t compare(const UnicodeString &x, const UnicodeString &y); 702e5b6d6dSopenharmony_ci int32_t compare(const Line &x, const Line &y); 712e5b6d6dSopenharmony_ci UColAttributeValue distanceFromEmptyString(const Line &x); 722e5b6d6dSopenharmony_ci UColAttributeValue distanceFromEmptyString(const UnicodeString &x); 732e5b6d6dSopenharmony_ci UBool isFrenchSecondary(UErrorCode &status); 742e5b6d6dSopenharmony_ci UBool isUpperFirst(UErrorCode &status); 752e5b6d6dSopenharmony_ci int getSortKey(const Line &l, uint8_t *buffer, int32_t buffCap) { 762e5b6d6dSopenharmony_ci return skgetter(l.name, l.len, buffer, buffCap); 772e5b6d6dSopenharmony_ci }; 782e5b6d6dSopenharmony_ci 792e5b6d6dSopenharmony_ci int getSortKey(UChar *string, int32_t sLen, uint8_t *buffer, int32_t buffCap) { 802e5b6d6dSopenharmony_ci return skgetter(string, sLen, buffer, buffCap); 812e5b6d6dSopenharmony_ci }; 822e5b6d6dSopenharmony_ci 832e5b6d6dSopenharmony_ci}; 842e5b6d6dSopenharmony_ci 852e5b6d6dSopenharmony_ci 862e5b6d6dSopenharmony_ci#endif //#ifndef COLPROBE_STRENGTHPROBE_H 872e5b6d6dSopenharmony_ci 88