- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- Search for |

- File List
- Globals

# errorcode.h

Go to the documentation of this file.

    00001 /*
    00002 *******************************************************************************
    00003 *
    00004 *   Copyright (C) 2009, International Business Machines
    00005 *   Corporation and others.  All Rights Reserved.
    00006 *
    00007 *******************************************************************************
    00008 *   file name:  errorcode.h
    00009 *   encoding:   US-ASCII
    00010 *   tab size:   8 (not used)
    00011 *   indentation:4
    00012 *
    00013 *   created on: 2009mar10
    00014 *   created by: Markus W. Scherer
    00015 */
    00016
    00017 #ifndef __ERRORCODE_H__
    00018 #define __ERRORCODE_H__
    00019
    00026 #include "unicode/utypes.h"
    00027 #include "unicode/uobject.h"
    00028
    00029 U_NAMESPACE_BEGIN
    00030
    00079 class U_COMMON_API ErrorCode: public UMemory {
    00080 public:
    00085     ErrorCode() : errorCode(U_ZERO_ERROR) {}
    00087     virtual ~ErrorCode() {}
    00089     operator UErrorCode & () { return errorCode; }
    00091     operator UErrorCode * () { return &errorCode; }
    00093     UBool isSuccess() const { return U_SUCCESS(errorCode); }
    00095     UBool isFailure() const { return U_FAILURE(errorCode); }
    00097     UErrorCode get() const { return errorCode; }
    00099     void set(UErrorCode value) { errorCode=value; }
    00101     UErrorCode reset();
    00109     void check() const;
    00110
    00111 protected:
    00116     UErrorCode errorCode;
    00123     virtual void handleFailure() const {}
    00124 };
    00125
    00126 U_NAMESPACE_END
    00127
    00128 #endif  // __ERRORCODE_H__