Public Types | Public Member Functions
CStatus Class Reference

Detailed Description

Encapsulates status data types for error handling purpose. The class also exposes methods to query and set the error code.

The error codes use the same values as the standard HRESULT error codes on Windows.

#include <xsi_status.h>

Inheritance diagram for CStatus:
Inheritance graph
[legend]

List of all members.

Public Types

enum   Code {
  Undefined = 0xFFFFFFFF,
  OK = 0,
  False = 1,
  Fail = 0x80004005L,
  InvalidArgument = 0x80070057L,
  OutOfMemory = 0x8007000EL,
  AccessDenied = 0x80070005L,
  Unexpected = 0x8000FFFFL,
  NotImpl = 0x80004001L,
  MemberNotFound = 0x80020003L,
  Abort = 0x80004004L,
  BadVarType = 0x80020008L
}
  Error code enumerator. More...

Public Member Functions

  CStatus (Code in_code=OK)
Code  GetCode () const
bool  Succeeded () const
void  PutCode (Code in_code)
CString  GetDescription () const
CStatus operator= (Code in_code)
bool  operator== (const CStatus &rhs) const
bool  operator== (Code rhs) const
bool  operator!= (const CStatus &rhs) const
bool  operator!= (Code rhs) const
void  AssertSucceeded (const CString &in_strText=CString()) const

Member Enumeration Documentation

enum Code

Error code enumerator.

Enumerator:
Undefined 

Undefined

OK 

OK

False 

False

Fail 

Fail

InvalidArgument 

InvalidArgument

OutOfMemory 

OutOfMemory

AccessDenied 

AccessDenied

Unexpected 

Unexpected

NotImpl 

NotImpl

MemberNotFound 

MemberNotFound

Abort 

Abort

BadVarType 

BadVarType


Constructor & Destructor Documentation

CStatus ( Code  in_code = OK )

Constructs a status object from a given error code.

Parameters:
in_code Error code

Member Function Documentation

Code GetCode ( ) const

Returns the underlying error code.

Returns:
Error code
bool Succeeded ( ) const

Returns true if the status is either OK or False

Returns:
true if OK or False, false otherwise.
void PutCode ( Code  in_code )

Sets the error code type

Parameters:
in_code Error code
CString GetDescription ( ) const

Gets the status code description.

Returns:
Error description string

Reimplemented in CScriptErrorDescriptor.

CStatus& operator= ( Code  in_code )

Sets the CStatus object with a given error code.

Parameters:
in_code Error code
Returns:
CStatus object.
bool operator== ( const CStatus rhs ) const

The equality operator that takes another CStatus object.

Parameters:
rhs status object
Returns:
bool
bool operator== ( Code  rhs ) const

The equality operator that takes a CStatus::Code.

Parameters:
rhs status code
Returns:
bool
bool operator!= ( const CStatus rhs ) const

The inequality operator that takes a CStatus object.

Parameters:
rhs status object
Returns:
bool
bool operator!= ( Code  rhs ) const

The inequality operator that takes a CStatus::Code.

Parameters:
rhs status code
Returns:
bool
void AssertSucceeded ( const CString in_strText = CString() ) const

Assert the current status code is OK or False.

Parameters:
in_strText Optional message logs if the function doesn't assert.
Returns:
bool

The documentation for this class was generated from the following file: