ICU 51.2  51.2
errorcode.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 *
4 * Copyright (C) 2009-2011, International Business Machines
5 * Corporation and others. All Rights Reserved.
6 *
7 *******************************************************************************
8 * file name: errorcode.h
9 * encoding: US-ASCII
10 * tab size: 8 (not used)
11 * indentation:4
12 *
13 * created on: 2009mar10
14 * created by: Markus W. Scherer
15 */
16 
17 #ifndef __ERRORCODE_H__
18 #define __ERRORCODE_H__
19 
26 #include "unicode/utypes.h"
27 #include "unicode/uobject.h"
28 
30 
80 public:
85  ErrorCode() : errorCode(U_ZERO_ERROR) {}
87  virtual ~ErrorCode();
89  operator UErrorCode & () { return errorCode; }
91  operator UErrorCode * () { return &errorCode; }
93  UBool isSuccess() const { return U_SUCCESS(errorCode); }
95  UBool isFailure() const { return U_FAILURE(errorCode); }
97  UErrorCode get() const { return errorCode; }
99  void set(UErrorCode value) { errorCode=value; }
101  UErrorCode reset();
111  void assertSuccess() const;
118  const char* errorName() const;
119 
120 protected:
132  virtual void handleFailure() const {}
133 };
134 
136 
137 #endif // __ERRORCODE_H__