typeinfo.mh

来自「开放源码的编译器open watcom 1.6.0版的源代码」· MH 代码 · 共 81 行

MH
81
字号
///////////////////////////////////////////////////////////////////////////
// FILE: typeinfo.h/typeinfo (RTTI support)
//
:keep CPP_HDR
:include crwat.sp
//
// Description: This header is part of the C++ standard library. It
//              defines some classes and exceptions that pertain to
//              run time type identification support.
///////////////////////////////////////////////////////////////////////////
:segment !CNAME
#ifndef _TYPEINFO_H_INCLUDED
#define _TYPEINFO_H_INCLUDED

:include readonly.sp

#ifndef _TYPEINFO_INCLUDED
  #include <typeinfo>
#endif
using std::type_info;
using std::bad_cast;
using std::bad_typeid;

// All included names should also be in the global namespace.
#ifndef _EXCEPTION_H_INCLUDED
  #include <exceptio.h>
#endif

#endif
:elsesegment
#ifndef _TYPEINFO_INCLUDED
#define _TYPEINFO_INCLUDED

:include readonly.sp

#ifndef __cplusplus
#error The header typeinfo requires C++
#endif

#ifndef _COMDEF_H_INCLUDED
 #include <_comdef.h>
#endif

#ifndef _EXCEPTION_INCLUDED
  #include <exceptio>
#endif

namespace std {

  class _WPRTLINK type_info {
  public:
    ~type_info();
    bool operator ==( type_info const & ) const;
    bool operator !=( type_info const & ) const;
    bool before( type_info const & ) const;
    const char *name() const;
    const char *raw_name() const;
  private:
    type_info( type_info const & );
    type_info & operator =( type_info const & );
    mutable void const *__data;
    char const __raw[1];
  };

  class _WPRTLINK bad_cast : public exception {
  public:
    bad_cast( ) _WCTHROWS()
        : exception( "invalid dynamic cast" ) { }
  };

  class _WPRTLINK bad_typeid : public exception {
  public:
    bad_typeid( ) _WCTHROWS()
        : exception( "bad typeid expression" ) { }
  };

} // namespace std

#endif
:endsegment

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?