]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/uelement.h
2 *******************************************************************************
3 * Copyright (C) 1997-2011, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 *******************************************************************************
6 * file name: uelement.h
8 * tab size: 8 (not used)
11 * created on: 2011jul04
12 * created by: Markus W. Scherer
14 * Common definitions for UHashTable and UVector.
15 * UHashTok moved here from uhash.h and renamed UElement.
16 * This allows users of UVector to avoid the confusing #include of uhash.h.
17 * uhash.h aliases UElement to UHashTok,
18 * so that we need not change all of its code and its users.
21 #ifndef __UELEMENT_H__
22 #define __UELEMENT_H__
24 #include "unicode/utypes.h"
29 * A UVector element, or a key or value within a UHashtable.
30 * It may be either a 32-bit integral value or an opaque void* pointer.
31 * The void* pointer may be smaller than 32 bits (e.g. 24 bits)
32 * or may be larger (e.g. 64 bits).
34 * Because a UElement is the size of a native pointer or a 32-bit
35 * integer, we pass it around by value.
41 typedef union UElement UElement
;
44 * An element-equality (boolean) comparison function.
45 * @param e1 An element (object or integer)
46 * @param e2 An element (object or integer)
47 * @return TRUE if the two elements are equal.
49 typedef UBool U_CALLCONV
UElementsAreEqual(const UElement e1
, const UElement e2
);
52 * An element sorting (three-way) comparison function.
53 * @param e1 An element (object or integer)
54 * @param e2 An element (object or integer)
55 * @return 0 if the two elements are equal, -1 if e1 is < e2, or +1 if e1 is > e2.
57 typedef int8_t U_CALLCONV
UElementComparator(UElement e1
, UElement e2
);
60 * An element assignment function. It may copy an integer, copy
61 * a pointer, or clone a pointer, as appropriate.
62 * @param dst The element to be assigned to
63 * @param src The element to assign from
65 typedef void U_CALLCONV
UElementAssigner(UElement
*dst
, UElement
*src
);
70 * Comparator function for UnicodeString* keys. Implements UElementsAreEqual.
71 * @param key1 The string for comparison
72 * @param key2 The string for comparison
73 * @return true if key1 and key2 are equal, return false otherwise.
75 U_CAPI UBool U_EXPORT2
76 uhash_compareUnicodeString(const UElement key1
, const UElement key2
);
79 * Comparator function for UnicodeString* keys (case insensitive).
80 * Make sure to use together with uhash_hashCaselessUnicodeString.
81 * Implements UElementsAreEqual.
82 * @param key1 The string for comparison
83 * @param key2 The string for comparison
84 * @return true if key1 and key2 are equal, return false otherwise.
86 U_CAPI UBool U_EXPORT2
87 uhash_compareCaselessUnicodeString(const UElement key1
, const UElement key2
);
89 #endif /* __UELEMENT_H__ */