diff options
author | neksard <neksard@yandex-team.ru> | 2022-02-10 16:45:33 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:33 +0300 |
commit | 1d9c550e7c38e051d7961f576013a482003a70d9 (patch) | |
tree | b2cc84ee7850122e7ccf51d0ea21e4fa7e7a5685 /contrib/libs/icu/common/uarrsort.h | |
parent | 8f7cf138264e0caa318144bf8a2c950e0b0a8593 (diff) | |
download | ydb-1d9c550e7c38e051d7961f576013a482003a70d9.tar.gz |
Restoring authorship annotation for <neksard@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/icu/common/uarrsort.h')
-rw-r--r-- | contrib/libs/icu/common/uarrsort.h | 202 |
1 files changed, 101 insertions, 101 deletions
diff --git a/contrib/libs/icu/common/uarrsort.h b/contrib/libs/icu/common/uarrsort.h index 988d2de2c3..a55dca5b9e 100644 --- a/contrib/libs/icu/common/uarrsort.h +++ b/contrib/libs/icu/common/uarrsort.h @@ -1,103 +1,103 @@ // © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -******************************************************************************* -* -* Copyright (C) 2003-2013, International Business Machines -* Corporation and others. All Rights Reserved. -* -******************************************************************************* -* file name: uarrsort.h +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2003-2013, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: uarrsort.h * encoding: UTF-8 -* tab size: 8 (not used) -* indentation:4 -* -* created on: 2003aug04 -* created by: Markus W. Scherer -* -* Internal function for sorting arrays. -*/ - -#ifndef __UARRSORT_H__ -#define __UARRSORT_H__ - -#include "unicode/utypes.h" - -U_CDECL_BEGIN -/** - * Function type for comparing two items as part of sorting an array or similar. - * Callback function for uprv_sortArray(). - * - * @param context Application-specific pointer, passed through by uprv_sortArray(). - * @param left Pointer to the "left" item. - * @param right Pointer to the "right" item. - * @return 32-bit signed integer comparison result: - * <0 if left<right - * ==0 if left==right - * >0 if left>right - * - * @internal - */ -typedef int32_t U_CALLCONV -UComparator(const void *context, const void *left, const void *right); -U_CDECL_END - -/** - * Array sorting function. - * Uses a UComparator for comparing array items to each other, and simple - * memory copying to move items. - * - * @param array The array to be sorted. - * @param length The number of items in the array. - * @param itemSize The size in bytes of each array item. - * @param cmp UComparator function used to compare two items each. - * @param context Application-specific pointer, passed through to the UComparator. - * @param sortStable If true, a stable sorting algorithm must be used. - * @param pErrorCode ICU in/out UErrorCode parameter. - * - * @internal - */ -U_CAPI void U_EXPORT2 -uprv_sortArray(void *array, int32_t length, int32_t itemSize, - UComparator *cmp, const void *context, - UBool sortStable, UErrorCode *pErrorCode); - -/** - * Convenience UComparator implementation for uint16_t arrays. - * @internal - */ -U_CAPI int32_t U_EXPORT2 -uprv_uint16Comparator(const void *context, const void *left, const void *right); - -/** - * Convenience UComparator implementation for int32_t arrays. - * @internal - */ -U_CAPI int32_t U_EXPORT2 -uprv_int32Comparator(const void *context, const void *left, const void *right); - -/** - * Convenience UComparator implementation for uint32_t arrays. - * @internal - */ -U_CAPI int32_t U_EXPORT2 -uprv_uint32Comparator(const void *context, const void *left, const void *right); - -/** - * Much like Java Collections.binarySearch(list, key, comparator). - * - * Except: Java documents "If the list contains multiple elements equal to - * the specified object, there is no guarantee which one will be found." - * - * This version here will return the largest index of any equal item, - * for use in stable sorting. - * - * @return the index>=0 where the item was found: - * the largest such index, if multiple, for stable sorting; - * or the index<0 for inserting the item at ~index in sorted order - */ -U_CAPI int32_t U_EXPORT2 -uprv_stableBinarySearch(char *array, int32_t length, void *item, int32_t itemSize, - UComparator *cmp, const void *context); - -#endif +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2003aug04 +* created by: Markus W. Scherer +* +* Internal function for sorting arrays. +*/ + +#ifndef __UARRSORT_H__ +#define __UARRSORT_H__ + +#include "unicode/utypes.h" + +U_CDECL_BEGIN +/** + * Function type for comparing two items as part of sorting an array or similar. + * Callback function for uprv_sortArray(). + * + * @param context Application-specific pointer, passed through by uprv_sortArray(). + * @param left Pointer to the "left" item. + * @param right Pointer to the "right" item. + * @return 32-bit signed integer comparison result: + * <0 if left<right + * ==0 if left==right + * >0 if left>right + * + * @internal + */ +typedef int32_t U_CALLCONV +UComparator(const void *context, const void *left, const void *right); +U_CDECL_END + +/** + * Array sorting function. + * Uses a UComparator for comparing array items to each other, and simple + * memory copying to move items. + * + * @param array The array to be sorted. + * @param length The number of items in the array. + * @param itemSize The size in bytes of each array item. + * @param cmp UComparator function used to compare two items each. + * @param context Application-specific pointer, passed through to the UComparator. + * @param sortStable If true, a stable sorting algorithm must be used. + * @param pErrorCode ICU in/out UErrorCode parameter. + * + * @internal + */ +U_CAPI void U_EXPORT2 +uprv_sortArray(void *array, int32_t length, int32_t itemSize, + UComparator *cmp, const void *context, + UBool sortStable, UErrorCode *pErrorCode); + +/** + * Convenience UComparator implementation for uint16_t arrays. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +uprv_uint16Comparator(const void *context, const void *left, const void *right); + +/** + * Convenience UComparator implementation for int32_t arrays. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +uprv_int32Comparator(const void *context, const void *left, const void *right); + +/** + * Convenience UComparator implementation for uint32_t arrays. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +uprv_uint32Comparator(const void *context, const void *left, const void *right); + +/** + * Much like Java Collections.binarySearch(list, key, comparator). + * + * Except: Java documents "If the list contains multiple elements equal to + * the specified object, there is no guarantee which one will be found." + * + * This version here will return the largest index of any equal item, + * for use in stable sorting. + * + * @return the index>=0 where the item was found: + * the largest such index, if multiple, for stable sorting; + * or the index<0 for inserting the item at ~index in sorted order + */ +U_CAPI int32_t U_EXPORT2 +uprv_stableBinarySearch(char *array, int32_t length, void *item, int32_t itemSize, + UComparator *cmp, const void *context); + +#endif |