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

- File List
- Globals

# errorcode.h

Go to the documentation of this file.

    00001 /*
    00002 *******************************************************************************
    00003 *
    00004 *   Copyright (C) 2009-2010, 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();
    00111     void assertSuccess() const;
    00118     const char* errorName() const;
    00119
    00120 protected:
    00125     UErrorCode errorCode;
    00132     virtual void handleFailure() const {}
    00133 };
    00134
    00135 U_NAMESPACE_END
    00136
    00137 #endif  // __ERRORCODE_H__

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines