ICU-11794 add uprv_isInvariantUnicodeString(), as requested by Markus

X-SVN-Rev: 37794
This commit is contained in:
Andy Heninger 2015-08-21 17:32:53 +00:00
parent 38d07de467
commit 60dcad0436
2 changed files with 21 additions and 2 deletions

View File

@ -105,7 +105,7 @@ CharString &CharString::appendInvariantChars(const UnicodeString &s, UErrorCode
if(U_FAILURE(errorCode)) {
return *this;
}
if (!uprv_isInvariantUString(s.getBuffer(), s.length())) {
if (!uprv_isInvariantUnicodeString(s)) {
errorCode = U_INVARIANT_CONVERSION_ERROR;
return *this;
}

View File

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 1999-2010, International Business Machines
* Copyright (C) 1999-2015, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -21,6 +21,9 @@
#define __UINVCHAR_H__
#include "unicode/utypes.h"
#ifdef __cplusplus
#include "unicode/unistr.h"
#endif
/**
* Check if a char string only contains invariant characters.
@ -48,6 +51,22 @@ uprv_isInvariantString(const char *s, int32_t length);
U_INTERNAL UBool U_EXPORT2
uprv_isInvariantUString(const UChar *s, int32_t length);
#ifdef __cplusplus
/**
* Check if a UnicodeString only contains invariant characters.
* See utypes.h for details.
*
* @param s Input string.
* @return TRUE if s contains only invariant characters.
*/
U_INTERNAL inline UBool U_EXPORT2
uprv_isInvariantUnicodeString(const icu::UnicodeString &s) {
return uprv_isInvariantUString(s.getBuffer(), s.length());
}
#endif /* __cplusplus */
/**
* \def U_UPPER_ORDINAL
* Get the ordinal number of an uppercase invariant character