Difference between revisions of "CXResultCode"

From cxwiki

(Created page with "<div class="mw-parser-output">CXResultCode provides an efficient and simple method for returning result/status codes from various common functions. It is not intended as a cat...")
 
(No difference)

Latest revision as of 00:54, 17 April 2018

CXResultCode provides an efficient and simple method for returning result/status codes from various common functions. It is not intended as a catch-all for every possible reporting mechanism, but rather as a starting point or error-reporting which is good enough for the majority of cases.
 
CXResultCode is effectively an enumeration class. It may be cast to or from an integer for debugging purposes, switching, etc. but is not intended to hold generic integer values. The class' bool-cast operators are deleted to avoid accidental misuse. Accessors are available to create a CXResultCode from common platform-specific error codes (posix errors, Windows error DWORDs, etc).
 
Instances of CXResultCode are often used as accumulators, where several operations are performed and the results concatenated to a single CXResultCode. In this usage, the result contains the first-occurring error, which is typically the most meaningful.
 

Methods

CXResultCode(void);
explicit CXResultCode(int value);
operator int(void);
operator int(void) const;
bool operator==(CXResultCode value) const;
bool operator!=(CXResultCode value) const;
const CXResultCode& ConcatenateResult(const CXResultCode& resultCode);
  
static CXResultCode FromPosixErr(int posixErr);
static CXResultCode FromCarbonOSStatus(OSStatus carbonErr);
static CXResultCode FromWindowsErr(DWORD windowsError);
 

Enumerations

static const CXResultCode OK;
static const CXResultCode NotInitialised;         // Object was not initialised before use
static const CXResultCode NotImplemented;         // Function or Data Type has not been implemented
static const CXResultCode Eof;                    // End-of-file was encountered during read/write operation
static const CXResultCode NodeRemoved;            // The node/file/item was deleted/removed/disconnected before the operation could complete
static const CXResultCode ParamErr;               // An invalid parameter was passed to the function (eg. NULL pointer)
static const CXResultCode DataLost;               // Data was lost, probably because a buffer was too small
static const CXResultCode NotFound;               // The searched key was not found
static const CXResultCode NodeBusy;               // The node/file/item is already open exclusively
static const CXResultCode AccessDenied;           // You havent been granted access to perform the requested operation on this node/file/item
static const CXResultCode WrongState;             // Handle was already open or object in wrong state to perform command
static const CXResultCode BadFormat;              // File format/protocol/response was incorrect or corrupted
static const CXResultCode DuplicateNode;          // The node/file/item was already present with the specified name/id/reference
static const CXResultCode TimeOut;                // The operation timed out
static const CXResultCode WrongFormat;            // The supplied data was of an unsuitable format
static const CXResultCode Cancelled;              // The operation was cancelled [by the user]
static const CXResultCode InternalFailure;        // An unspecified internal error occurred.
static const CXResultCode WouldBlockTryAgain;     // The non-blocking function call was unable to execute at the current time. Retrying the call later may succeed.