stdexcep.mh
来自「开放源码的编译器open watcom 1.6.0版的源代码」· MH 代码 · 共 129 行
MH
129 行
///////////////////////////////////////////////////////////////////////////
// FILE: stdexcept.h/stdexcept (Standard exception classes)
//
:keep CPP_HDR
:include crwat.sp
//
// Description: This header is part of the C++ standard library. It
// defines various exception classes based on exception.
///////////////////////////////////////////////////////////////////////////
:segment !CNAME
#ifndef _STDEXCEPT_H_INCLUDED
#define _STDEXCEPT_H_INCLUDED
:include readonly.sp
#ifndef _STDEXCEPT_INCLUDED
#include <stdexcep>
#endif
using std::logic_error;
using std::domain_error;
using std::invalid_argument;
using std::length_error;
using std::out_of_range;
using std::runtime_error;
using std::range_error;
using std::overflow_error;
using std::underflow_error;
// All included names should also be in the global namespace.
#ifndef _EXCEPTION_H_INCLUDED
#include <exceptio.h>
#endif
#endif
:elsesegment
#ifndef _STDEXCEPT_INCLUDED
#define _STDEXCEPT_INCLUDED
:include readonly.sp
#ifndef __cplusplus
#error The header stdexcept requires C++
#endif
#ifndef _COMDEF_H_INCLUDED
#include <_comdef.h>
#endif
#ifndef __STRDEF_H_INCLUDED
#include <_strdef.h>
#endif
#ifndef _EXCEPTION_INCLUDED
#include <exceptio>
#endif
namespace std {
namespace _ow {
class _WPRTLINK str_exception : public exception {
string message;
public:
str_exception( const string &what_arg ) _WCTHROWS()
: message( what_arg ) { }
virtual const char *what( ) const _WCTHROWS()
{ return message.c_str( ); }
};
}
class _WPRTLINK logic_error : public _ow::str_exception {
public:
logic_error( const string &what_arg ) _WCTHROWS()
: _ow::str_exception( what_arg ) { }
};
class _WPRTLINK domain_error : public logic_error {
public:
domain_error( const string &what_arg ) _WCTHROWS()
: logic_error( what_arg ) { }
};
class _WPRTLINK invalid_argument : public logic_error {
public:
invalid_argument( const string &what_arg ) _WCTHROWS()
: logic_error( what_arg ) { }
};
class _WPRTLINK length_error : public logic_error {
public:
length_error( const string &what_arg ) _WCTHROWS()
: logic_error( what_arg ) { }
};
class _WPRTLINK out_of_range : public logic_error {
public:
out_of_range( const string &what_arg ) _WCTHROWS()
: logic_error( what_arg ) { }
};
class _WPRTLINK runtime_error : public _ow::str_exception {
public:
runtime_error( const string &what_arg ) _WCTHROWS()
: _ow::str_exception( what_arg ) { }
};
class _WPRTLINK range_error : public runtime_error {
public:
range_error( const string &what_arg ) _WCTHROWS()
: runtime_error( what_arg ) { }
};
class _WPRTLINK overflow_error : public runtime_error {
public:
overflow_error( const string &what_arg ) _WCTHROWS()
: runtime_error( what_arg ) { }
};
class _WPRTLINK underflow_error : public runtime_error {
public:
underflow_error( const string &what_arg ) _WCTHROWS()
: runtime_error( what_arg ) { }
};
} // namespace std
#endif
:endsegment
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?