]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/ustr_imp.h
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 **********************************************************************
5 * Copyright (C) 1999-2015, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
8 * file name: ustr_imp.h
10 * tab size: 8 (not used)
13 * created on: 2001jan30
14 * created by: Markus W. Scherer
17 #ifndef __USTR_IMP_H__
18 #define __USTR_IMP_H__
20 #include "unicode/utypes.h"
23 * Internal option for unorm_cmpEquivFold() for strncmp style.
24 * If set, checks for both string length and terminating NUL.
26 #define _STRNCMP_STYLE 0x1000
29 * Compare two strings in code point order or code unit order.
30 * Works in strcmp style (both lengths -1),
31 * strncmp style (lengths equal and >=0, flag TRUE),
32 * and memcmp/UnicodeString style (at least one length >=0).
34 U_CFUNC
int32_t U_EXPORT2
35 uprv_strCompare(const UChar
*s1
, int32_t length1
,
36 const UChar
*s2
, int32_t length2
,
37 UBool strncmpStyle
, UBool codePointOrder
);
39 U_CAPI
int32_t U_EXPORT2
40 ustr_hashUCharsN(const UChar
*str
, int32_t length
);
42 U_CAPI
int32_t U_EXPORT2
43 ustr_hashCharsN(const char *str
, int32_t length
);
45 U_CAPI
int32_t U_EXPORT2
46 ustr_hashICharsN(const char *str
, int32_t length
);
49 * NUL-terminate a UChar * string if possible.
50 * If length < destCapacity then NUL-terminate.
51 * If length == destCapacity then do not terminate but set U_STRING_NOT_TERMINATED_WARNING.
52 * If length > destCapacity then do not terminate but set U_BUFFER_OVERFLOW_ERROR.
54 * @param dest Destination buffer, can be NULL if destCapacity==0.
55 * @param destCapacity Number of UChars available at dest.
56 * @param length Number of UChars that were (to be) written to dest.
57 * @param pErrorCode ICU error code.
60 U_CAPI
int32_t U_EXPORT2
61 u_terminateUChars(UChar
*dest
, int32_t destCapacity
, int32_t length
, UErrorCode
*pErrorCode
);
64 * NUL-terminate a char * string if possible.
65 * Same as u_terminateUChars() but for a different string type.
67 U_CAPI
int32_t U_EXPORT2
68 u_terminateChars(char *dest
, int32_t destCapacity
, int32_t length
, UErrorCode
*pErrorCode
);
71 * NUL-terminate a UChar32 * string if possible.
72 * Same as u_terminateUChars() but for a different string type.
74 U_CAPI
int32_t U_EXPORT2
75 u_terminateUChar32s(UChar32
*dest
, int32_t destCapacity
, int32_t length
, UErrorCode
*pErrorCode
);
78 * NUL-terminate a wchar_t * string if possible.
79 * Same as u_terminateUChars() but for a different string type.
81 U_CAPI
int32_t U_EXPORT2
82 u_terminateWChars(wchar_t *dest
, int32_t destCapacity
, int32_t length
, UErrorCode
*pErrorCode
);