1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/fontservices/textshaperplugin/IcuSource/common/uarrsort.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,84 @@
1.4 +/*
1.5 +*******************************************************************************
1.6 +*
1.7 +* Copyright (C) 2003, International Business Machines
1.8 +* Corporation and others. All Rights Reserved.
1.9 +*
1.10 +*******************************************************************************
1.11 +* file name: uarrsort.h
1.12 +* encoding: US-ASCII
1.13 +* tab size: 8 (not used)
1.14 +* indentation:4
1.15 +*
1.16 +* created on: 2003aug04
1.17 +* created by: Markus W. Scherer
1.18 +*
1.19 +* Internal function for sorting arrays.
1.20 +*/
1.21 +
1.22 +#ifndef __UARRSORT_H__
1.23 +#define __UARRSORT_H__
1.24 +
1.25 +#include "unicode/utypes.h"
1.26 +
1.27 +U_CDECL_BEGIN
1.28 +/**
1.29 + * Function type for comparing two items as part of sorting an array or similar.
1.30 + * Callback function for uprv_sortArray().
1.31 + *
1.32 + * @param context Application-specific pointer, passed through by uprv_sortArray().
1.33 + * @param left Pointer to the "left" item.
1.34 + * @param right Pointer to the "right" item.
1.35 + * @return 32-bit signed integer comparison result:
1.36 + * <0 if left<right
1.37 + * ==0 if left==right
1.38 + * >0 if left>right
1.39 + *
1.40 + * @internal
1.41 + */
1.42 +typedef int32_t U_CALLCONV
1.43 +UComparator(const void *context, const void *left, const void *right);
1.44 +U_CDECL_END
1.45 +
1.46 +/**
1.47 + * Array sorting function.
1.48 + * Uses a UComparator for comparing array items to each other, and simple
1.49 + * memory copying to move items.
1.50 + *
1.51 + * @param array The array to be sorted.
1.52 + * @param length The number of items in the array.
1.53 + * @param itemSize The size in bytes of each array item.
1.54 + * @param cmp UComparator function used to compare two items each.
1.55 + * @param context Application-specific pointer, passed through to the UComparator.
1.56 + * @param sortStable If true, a stable sorting algorithm must be used.
1.57 + * @param pErrorCode ICU in/out UErrorCode parameter.
1.58 + *
1.59 + * @internal
1.60 + */
1.61 +U_CAPI void U_EXPORT2
1.62 +uprv_sortArray(void *array, int32_t length, int32_t itemSize,
1.63 + UComparator *cmp, const void *context,
1.64 + UBool sortStable, UErrorCode *pErrorCode);
1.65 +
1.66 +/**
1.67 + * Convenience UComparator implementation for uint16_t arrays.
1.68 + * @internal
1.69 + */
1.70 +U_CAPI int32_t U_EXPORT2
1.71 +uprv_uint16Comparator(const void *context, const void *left, const void *right);
1.72 +
1.73 +/**
1.74 + * Convenience UComparator implementation for int32_t arrays.
1.75 + * @internal
1.76 + */
1.77 +U_CAPI int32_t U_EXPORT2
1.78 +uprv_int32Comparator(const void *context, const void *left, const void *right);
1.79 +
1.80 +/**
1.81 + * Convenience UComparator implementation for uint32_t arrays.
1.82 + * @internal
1.83 + */
1.84 +U_CAPI int32_t U_EXPORT2
1.85 +uprv_uint32Comparator(const void *context, const void *left, const void *right);
1.86 +
1.87 +#endif