ERRORSTATE Class Reference

#include <mi32/errhandler.h>

List of all members.

Public Member Functions

 ERRORSTATE (const ERRORSTATE &rhs)
 ERRORSTATE ()
 ~ERRORSTATE ()
void Clear ()
void CopyFromThread ()
void Disable ()
void Enable ()
const MISTRINGGetDetails () const
ERRVALUE GetErrValue () const
const MISTRINGGetMessage () const
MISTRINGGetMessageRef ()
MISTRINGGetPlaceHolderRef ()
MISTRING GetReport () const
const MISTRINGGetTrace () const
bool IsDisabled () const
ERRORSTATEoperator= (const ERRORSTATE &rhs)
void SetDetails (const MISTRING &details)
ERRVALUE SetPosn (ERRVALUE errcode, const char *rcsid, int line)

Static Public Member Functions

static MISTRING GetMessageFirstLine (int errcode)
static MISTRING GetMessageSingleLine (int errcode)
static ERRORSTATEGetThreadErrStateRef ()
static ERRORSTATEGetThreadErrStateRefFast ()

Constructor & Destructor Documentation

ERRORSTATE::ERRORSTATE (  ) 

Ctor.

ERRORSTATE::ERRORSTATE ( const ERRORSTATE rhs  ) 

Copy ctor.

ERRORSTATE::~ERRORSTATE (  ) 

Dtor.


Member Function Documentation

void ERRORSTATE::Clear (  ) 

Clear the current error, Message string, Trace stack, and the Details string.

void ERRORSTATE::CopyFromThread (  )  [inline]

Copy the thread's error state instance into 'this'.

void ERRORSTATE::Disable (  ) 

Disable error position reporting.

This is important when cleaning up after an error. It often happens that if you get an error, you need to cleanup (close files, etc) before returning. If something in your cleanup code also causes an error, it will wipe out the error trace that you're trying to report. Therefore, always bracket cleanup code with Diaable()/Enable().

void ERRORSTATE::Enable (  ) 

Reenable error position reporting.

See also:
Disable()
const MISTRING& ERRORSTATE::GetDetails (  )  const

Get the details string set by SetDetails().

ERRVALUE ERRORSTATE::GetErrValue (  )  const

Get current error value.

const MISTRING& ERRORSTATE::GetMessage (  )  const

Get the error message string set by SetPosn().

static MISTRING ERRORSTATE::GetMessageFirstLine ( int  errcode  )  [static]

Get the first line of the Message string generated by 'errcode'.

MISTRING& ERRORSTATE::GetMessageRef (  ) 

Get MISTRING reference to current error message.

This allows subsequent use of the << operator on the string to substitute or append additional error values for -format or $-position codes.

static MISTRING ERRORSTATE::GetMessageSingleLine ( int  errcode  )  [static]

Get the Message string as a single line (All newlines replaced with spaces) generated by 'errcode'.

MISTRING& ERRORSTATE::GetPlaceHolderRef (  ) 

In some cases getting the message string is not possible or desired, therefore we need to have a place holder.

Usually a static declaration in a method would suffice, but ERRORSTATE is stored in Thread Local Storage, therefore we need the place holder string in thread local storage.

MISTRING ERRORSTATE::GetReport (  )  const

Get the standard combination of "Message + errcode + Trace" string set by SetPosn().

static ERRORSTATE& ERRORSTATE::GetThreadErrStateRef (  )  [static]

Get the thread's current error state.

When calling SetErrPosn(), the error is stored in thread local storage. This method allows the caller to get the current error state for the current thread. If copying to another thread, a copy MUST be made in order not to mess up the class internals of the thread's error state. This restores the value of GetLastError() through the call to TlsGetValue() for Windows, so it is slower.

static ERRORSTATE& ERRORSTATE::GetThreadErrStateRefFast (  )  [static]

Get the thread's current error state.

When calling SetErrPosn(), the error is stored in thread local storage. This method allows the caller to get the current error state for the current thread. If copying to another thread, a copy MUST be made in order not to mess up the class internals of the thread's error state.

const MISTRING& ERRORSTATE::GetTrace (  )  const

Get the stack trace string set by SetPosn().

bool ERRORSTATE::IsDisabled (  )  const

Determine if error position recording is disabled.

ERRORSTATE& ERRORSTATE::operator= ( const ERRORSTATE rhs  ) 

Assignment.

void ERRORSTATE::SetDetails ( const MISTRING details  ) 

Set the details string for an error.

This can be used to report any extra details about an error. If set, the standard error dialog will have a "detail..." button which will let the user see the details.

ERRVALUE ERRORSTATE::SetPosn ( ERRVALUE  errcode,
const char *  rcsid,
int  line 
)

Sets the error value and appends the stack trace line to the Trace string.


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

Generated on Sun Oct 7 21:33:21 2012 for TNTsdk 2012 by  doxygen 1.6.1