X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..f3c0d7a59d99c2a94c6b8822291f0e42be3773c9:/icuSources/tools/toolutil/uparse.h diff --git a/icuSources/tools/toolutil/uparse.h b/icuSources/tools/toolutil/uparse.h index 7f7b8f3d..df0e79a2 100644 --- a/icuSources/tools/toolutil/uparse.h +++ b/icuSources/tools/toolutil/uparse.h @@ -1,12 +1,14 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * -* Copyright (C) 2000-2003, International Business Machines +* Copyright (C) 2000-2010, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: uparse.h -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -23,6 +25,12 @@ #include "unicode/utypes.h" +/** + * Is c an invariant-character whitespace? + * @param c invariant character + */ +#define U_IS_INV_WHITESPACE(c) ((c)==' ' || (c)=='\t' || (c)=='\r' || (c)=='\n') + U_CDECL_BEGIN /** @@ -34,6 +42,15 @@ U_CDECL_BEGIN U_CAPI const char * U_EXPORT2 u_skipWhitespace(const char *s); +/** + * Trim whitespace (including line endings) from the end of the string. + * + * @param s Pointer to the string. + * @return Pointer to the new end of the string. + */ +U_CAPI char * U_EXPORT2 +u_rtrim(char *s); + /** Function type for u_parseDelimitedFile(). */ typedef void U_CALLCONV UParseLineFn(void *context, @@ -117,13 +134,16 @@ u_parseCodePointRange(const char *s, uint32_t *pStart, uint32_t *pEnd, UErrorCode *pErrorCode); - -U_CAPI const UChar * U_EXPORT2 -u_strSkipWhiteSpace(const UChar *s, int32_t length); - - -U_CAPI const UChar * U_EXPORT2 -u_strTrailingWhiteSpaceStart(const UChar *s, int32_t length); +/** + * Same as u_parseCodePointRange() but the range may be terminated by + * any character. The position of the terminating character is returned via + * the *terminator output parameter. + */ +U_CAPI int32_t U_EXPORT2 +u_parseCodePointRangeAnyTerminator(const char *s, + uint32_t *pStart, uint32_t *pEnd, + const char **terminator, + UErrorCode *pErrorCode); U_CAPI int32_t U_EXPORT2 u_parseUTF8(const char *source, int32_t sLen, char *dest, int32_t destCapacity, UErrorCode *status);