Imported Upstream version 58.1
[platform/upstream/icu.git] / source / common / errorcode.cpp
1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 *******************************************************************************
5 *
6 *   Copyright (C) 2009-2011, International Business Machines
7 *   Corporation and others.  All Rights Reserved.
8 *
9 *******************************************************************************
10 *   file name:  errorcode.cpp
11 *   encoding:   US-ASCII
12 *   tab size:   8 (not used)
13 *   indentation:4
14 *
15 *   created on: 2009mar10
16 *   created by: Markus W. Scherer
17 */
18
19 #include "unicode/utypes.h"
20 #include "unicode/errorcode.h"
21
22 U_NAMESPACE_BEGIN
23
24 ErrorCode::~ErrorCode() {}
25
26 UErrorCode ErrorCode::reset() {
27     UErrorCode code = errorCode;
28     errorCode = U_ZERO_ERROR;
29     return code;
30 }
31
32 void ErrorCode::assertSuccess() const {
33     if(isFailure()) {
34         handleFailure();
35     }
36 }
37
38 const char* ErrorCode::errorName() const {
39   return u_errorName(errorCode);
40 }
41
42 U_NAMESPACE_END