sl@0
|
1 |
/*
|
sl@0
|
2 |
*******************************************************************************
|
sl@0
|
3 |
*
|
sl@0
|
4 |
* Copyright (C) 2003, International Business Machines
|
sl@0
|
5 |
* Corporation and others. All Rights Reserved.
|
sl@0
|
6 |
*
|
sl@0
|
7 |
*******************************************************************************
|
sl@0
|
8 |
* file name: uarrsort.h
|
sl@0
|
9 |
* encoding: US-ASCII
|
sl@0
|
10 |
* tab size: 8 (not used)
|
sl@0
|
11 |
* indentation:4
|
sl@0
|
12 |
*
|
sl@0
|
13 |
* created on: 2003aug04
|
sl@0
|
14 |
* created by: Markus W. Scherer
|
sl@0
|
15 |
*
|
sl@0
|
16 |
* Internal function for sorting arrays.
|
sl@0
|
17 |
*/
|
sl@0
|
18 |
|
sl@0
|
19 |
#ifndef __UARRSORT_H__
|
sl@0
|
20 |
#define __UARRSORT_H__
|
sl@0
|
21 |
|
sl@0
|
22 |
#include "unicode/utypes.h"
|
sl@0
|
23 |
|
sl@0
|
24 |
U_CDECL_BEGIN
|
sl@0
|
25 |
/**
|
sl@0
|
26 |
* Function type for comparing two items as part of sorting an array or similar.
|
sl@0
|
27 |
* Callback function for uprv_sortArray().
|
sl@0
|
28 |
*
|
sl@0
|
29 |
* @param context Application-specific pointer, passed through by uprv_sortArray().
|
sl@0
|
30 |
* @param left Pointer to the "left" item.
|
sl@0
|
31 |
* @param right Pointer to the "right" item.
|
sl@0
|
32 |
* @return 32-bit signed integer comparison result:
|
sl@0
|
33 |
* <0 if left<right
|
sl@0
|
34 |
* ==0 if left==right
|
sl@0
|
35 |
* >0 if left>right
|
sl@0
|
36 |
*
|
sl@0
|
37 |
* @internal
|
sl@0
|
38 |
*/
|
sl@0
|
39 |
typedef int32_t U_CALLCONV
|
sl@0
|
40 |
UComparator(const void *context, const void *left, const void *right);
|
sl@0
|
41 |
U_CDECL_END
|
sl@0
|
42 |
|
sl@0
|
43 |
/**
|
sl@0
|
44 |
* Array sorting function.
|
sl@0
|
45 |
* Uses a UComparator for comparing array items to each other, and simple
|
sl@0
|
46 |
* memory copying to move items.
|
sl@0
|
47 |
*
|
sl@0
|
48 |
* @param array The array to be sorted.
|
sl@0
|
49 |
* @param length The number of items in the array.
|
sl@0
|
50 |
* @param itemSize The size in bytes of each array item.
|
sl@0
|
51 |
* @param cmp UComparator function used to compare two items each.
|
sl@0
|
52 |
* @param context Application-specific pointer, passed through to the UComparator.
|
sl@0
|
53 |
* @param sortStable If true, a stable sorting algorithm must be used.
|
sl@0
|
54 |
* @param pErrorCode ICU in/out UErrorCode parameter.
|
sl@0
|
55 |
*
|
sl@0
|
56 |
* @internal
|
sl@0
|
57 |
*/
|
sl@0
|
58 |
U_CAPI void U_EXPORT2
|
sl@0
|
59 |
uprv_sortArray(void *array, int32_t length, int32_t itemSize,
|
sl@0
|
60 |
UComparator *cmp, const void *context,
|
sl@0
|
61 |
UBool sortStable, UErrorCode *pErrorCode);
|
sl@0
|
62 |
|
sl@0
|
63 |
/**
|
sl@0
|
64 |
* Convenience UComparator implementation for uint16_t arrays.
|
sl@0
|
65 |
* @internal
|
sl@0
|
66 |
*/
|
sl@0
|
67 |
U_CAPI int32_t U_EXPORT2
|
sl@0
|
68 |
uprv_uint16Comparator(const void *context, const void *left, const void *right);
|
sl@0
|
69 |
|
sl@0
|
70 |
/**
|
sl@0
|
71 |
* Convenience UComparator implementation for int32_t arrays.
|
sl@0
|
72 |
* @internal
|
sl@0
|
73 |
*/
|
sl@0
|
74 |
U_CAPI int32_t U_EXPORT2
|
sl@0
|
75 |
uprv_int32Comparator(const void *context, const void *left, const void *right);
|
sl@0
|
76 |
|
sl@0
|
77 |
/**
|
sl@0
|
78 |
* Convenience UComparator implementation for uint32_t arrays.
|
sl@0
|
79 |
* @internal
|
sl@0
|
80 |
*/
|
sl@0
|
81 |
U_CAPI int32_t U_EXPORT2
|
sl@0
|
82 |
uprv_uint32Comparator(const void *context, const void *left, const void *right);
|
sl@0
|
83 |
|
sl@0
|
84 |
#endif
|