intl/icu/source/common/uelement.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial