JX Application Framework
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
JAssertBase Class Referenceabstract

#include <JAssertBase.h>

Inheritance diagram for JAssertBase:
[legend]

Public Types

enum  Action {
  kIgnoreFailure ,
  kAbort ,
  kAskUser
}
 

Public Member Functions

 JAssertBase ()
 
virtual ~JAssertBase ()
 
virtual int Assert (const JUtf8Byte *expr, const JUtf8Byte *file, const int line, const JUtf8Byte *message, const JUtf8Byte *function)=0
 
virtual void Abort ()
 

Static Public Member Functions

static int DefaultAssert (const JUtf8Byte *expr, const JUtf8Byte *file, const int line, const JUtf8Byte *message, const JUtf8Byte *function)
 
static Action GetAction ()
 
static void SetAction (const Action action)
 

Detailed Description

Base class for reporting fatal errors

Base class for global object that handles assert() macro.

To use this system, create a derived class and pass it to JInitCore().

Derived classes must override Assert().  This returns zero if the
program is supposed to continue.  Otherwise, it should call abort().

DefaultAssert() uses the environment variable J_ASSERT_ACTION to
determine how the assert() macro behaves:

    "ask_user"          prints message and asks "abort or continue?"
    any other value     prints message and calls abort()
    undefined           prints message and calls abort()
    "silent"            ignores the failure (unsafe if assert() is used correctly)

This action is settable at run-time via SetAction().

Member Enumeration Documentation

◆ Action

Enumerator
kIgnoreFailure 
kAbort 
kAskUser 

Constructor & Destructor Documentation

◆ JAssertBase()

JAssertBase::JAssertBase ( )

◆ ~JAssertBase()

JAssertBase::~JAssertBase ( )
virtual

Member Function Documentation

◆ Abort()

void JAssertBase::Abort ( )
virtual

Derived classes can override this to perform clean-up.

Reimplemented in JXAssert.

◆ Assert()

virtual int JAssertBase::Assert ( const JUtf8Byte expr,
const JUtf8Byte file,
const int  line,
const JUtf8Byte message,
const JUtf8Byte function 
)
pure virtual

Implemented in JXAssert.

◆ DefaultAssert()

int JAssertBase::DefaultAssert ( const JUtf8Byte expr,
const JUtf8Byte file,
const int  line,
const JUtf8Byte message,
const JUtf8Byte function 
)
static

◆ GetAction()

JAssertBase::Action JAssertBase::GetAction ( )
static

◆ SetAction()

void JAssertBase::SetAction ( const Action  action)
static

We can't call unsetenv() because SunOS 4.1.4 doesn't have it.


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