From 4a6d872c2119e23e50e974d7570b9f03c6099566 Mon Sep 17 00:00:00 2001 From: Fredrik Roubert Date: Mon, 9 Nov 2009 15:40:57 +0000 Subject: [PATCH] ICU-7121 add ErrorCode::errorName() convenience method X-SVN-Rev: 26856 --- icu4c/source/common/errorcode.cpp | 4 ++++ icu4c/source/common/unicode/errorcode.h | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/icu4c/source/common/errorcode.cpp b/icu4c/source/common/errorcode.cpp index c6ce1872b08..4ff151e3e48 100644 --- a/icu4c/source/common/errorcode.cpp +++ b/icu4c/source/common/errorcode.cpp @@ -31,4 +31,8 @@ void ErrorCode::assertSuccess() const { } } +const char* ErrorCode::errorName() const { + return u_errorName(errorCode); +} + U_NAMESPACE_END diff --git a/icu4c/source/common/unicode/errorcode.h b/icu4c/source/common/unicode/errorcode.h index f41af41e34b..aa91d947861 100644 --- a/icu4c/source/common/unicode/errorcode.h +++ b/icu4c/source/common/unicode/errorcode.h @@ -109,6 +109,13 @@ public: * @draft ICU 4.4 */ void assertSuccess() const; + /** + * Return a string for the UErrorCode value. + * The string will be the same as the name of the error code constant + * in the UErrorCode enum. + * @draft ICU 4.4 + */ + const char* errorName() const; protected: /**