]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/uarrsort.h
2 *******************************************************************************
4 * Copyright (C) 2003, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 *******************************************************************************
8 * file name: uarrsort.h
10 * tab size: 8 (not used)
13 * created on: 2003aug04
14 * created by: Markus W. Scherer
16 * Internal function for sorting arrays.
19 #ifndef __UARRSORT_H__
20 #define __UARRSORT_H__
22 #include "unicode/utypes.h"
26 * Function type for comparing two items as part of sorting an array or similar.
27 * Callback function for uprv_sortArray().
29 * @param context Application-specific pointer, passed through by uprv_sortArray().
30 * @param left Pointer to the "left" item.
31 * @param right Pointer to the "right" item.
32 * @return 32-bit signed integer comparison result:
39 typedef int32_t U_CALLCONV
40 UComparator(const void *context
, const void *left
, const void *right
);
44 * Array sorting function.
45 * Uses a UComparator for comparing array items to each other, and simple
46 * memory copying to move items.
48 * @param array The array to be sorted.
49 * @param length The number of items in the array.
50 * @param itemSize The size in bytes of each array item.
51 * @param cmp UComparator function used to compare two items each.
52 * @param context Application-specific pointer, passed through to the UComparator.
53 * @param sortStable If true, a stable sorting algorithm must be used.
54 * @param pErrorCode ICU in/out UErrorCode parameter.
59 uprv_sortArray(void *array
, int32_t length
, int32_t itemSize
,
60 UComparator
*cmp
, const void *context
,
61 UBool sortStable
, UErrorCode
*pErrorCode
);
64 * Convenience UComparator implementation for uint16_t arrays.
67 U_CAPI
int32_t U_EXPORT2
68 uprv_uint16Comparator(const void *context
, const void *left
, const void *right
);
71 * Convenience UComparator implementation for int32_t arrays.
74 U_CAPI
int32_t U_EXPORT2
75 uprv_int32Comparator(const void *context
, const void *left
, const void *right
);
78 * Convenience UComparator implementation for uint32_t arrays.
81 U_CAPI
int32_t U_EXPORT2
82 uprv_uint32Comparator(const void *context
, const void *left
, const void *right
);