]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/uelement.h
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 *******************************************************************************
5 * Copyright (C) 1997-2011, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 *******************************************************************************
8 * file name: uelement.h
10 * tab size: 8 (not used)
13 * created on: 2011jul04
14 * created by: Markus W. Scherer
16 * Common definitions for UHashTable and UVector.
17 * UHashTok moved here from uhash.h and renamed UElement.
18 * This allows users of UVector to avoid the confusing #include of uhash.h.
19 * uhash.h aliases UElement to UHashTok,
20 * so that we need not change all of its code and its users.
23 #ifndef __UELEMENT_H__
24 #define __UELEMENT_H__
26 #include "unicode/utypes.h"
31 * A UVector element, or a key or value within a UHashtable.
32 * It may be either a 32-bit integral value or an opaque void* pointer.
33 * The void* pointer may be smaller than 32 bits (e.g. 24 bits)
34 * or may be larger (e.g. 64 bits).
36 * Because a UElement is the size of a native pointer or a 32-bit
37 * integer, we pass it around by value.
43 typedef union UElement UElement
;
46 * An element-equality (boolean) comparison function.
47 * @param e1 An element (object or integer)
48 * @param e2 An element (object or integer)
49 * @return TRUE if the two elements are equal.
51 typedef UBool U_CALLCONV
UElementsAreEqual(const UElement e1
, const UElement e2
);
54 * An element sorting (three-way) comparison function.
55 * @param e1 An element (object or integer)
56 * @param e2 An element (object or integer)
57 * @return 0 if the two elements are equal, -1 if e1 is < e2, or +1 if e1 is > e2.
59 typedef int8_t U_CALLCONV
UElementComparator(UElement e1
, UElement e2
);
62 * An element assignment function. It may copy an integer, copy
63 * a pointer, or clone a pointer, as appropriate.
64 * @param dst The element to be assigned to
65 * @param src The element to assign from
67 typedef void U_CALLCONV
UElementAssigner(UElement
*dst
, UElement
*src
);
72 * Comparator function for UnicodeString* keys. Implements UElementsAreEqual.
73 * @param key1 The string for comparison
74 * @param key2 The string for comparison
75 * @return true if key1 and key2 are equal, return false otherwise.
77 U_CAPI UBool U_EXPORT2
78 uhash_compareUnicodeString(const UElement key1
, const UElement key2
);
81 * Comparator function for UnicodeString* keys (case insensitive).
82 * Make sure to use together with uhash_hashCaselessUnicodeString.
83 * Implements UElementsAreEqual.
84 * @param key1 The string for comparison
85 * @param key2 The string for comparison
86 * @return true if key1 and key2 are equal, return false otherwise.
88 U_CAPI UBool U_EXPORT2
89 uhash_compareCaselessUnicodeString(const UElement key1
, const UElement key2
);
91 #endif /* __UELEMENT_H__ */