2010-05-11 21:42:16 +02:00
|
|
|
// -*- C++ -*-
|
|
|
|
//===-------------------------- typeinfo ----------------------------------===//
|
|
|
|
//
|
2010-05-11 23:36:01 +02:00
|
|
|
// The LLVM Compiler Infrastructure
|
2010-05-11 21:42:16 +02:00
|
|
|
//
|
2010-11-16 23:09:02 +01:00
|
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
|
|
// Source Licenses. See LICENSE.TXT for details.
|
2010-05-11 21:42:16 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef __LIBCPP_TYPEINFO
|
|
|
|
#define __LIBCPP_TYPEINFO
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
typeinfo synopsis
|
|
|
|
|
|
|
|
namespace std {
|
|
|
|
|
|
|
|
class type_info
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~type_info();
|
2010-08-22 02:02:43 +02:00
|
|
|
|
2011-05-26 20:23:59 +02:00
|
|
|
bool operator==(const type_info& rhs) const noexcept;
|
|
|
|
bool operator!=(const type_info& rhs) const noexcept;
|
2010-08-22 02:02:43 +02:00
|
|
|
|
2011-05-26 20:23:59 +02:00
|
|
|
bool before(const type_info& rhs) const noexcept;
|
|
|
|
size_t hash_code() const noexcept;
|
|
|
|
const char* name() const noexcept;
|
2010-08-22 02:02:43 +02:00
|
|
|
|
2010-05-11 21:42:16 +02:00
|
|
|
type_info(const type_info& rhs) = delete;
|
|
|
|
type_info& operator=(const type_info& rhs) = delete;
|
|
|
|
};
|
|
|
|
|
|
|
|
class bad_cast
|
|
|
|
: public exception
|
|
|
|
{
|
|
|
|
public:
|
2011-05-26 20:23:59 +02:00
|
|
|
bad_cast() noexcept;
|
|
|
|
bad_cast(const bad_cast&) noexcept;
|
|
|
|
bad_cast& operator=(const bad_cast&) noexcept;
|
|
|
|
virtual const char* what() const noexcept;
|
2010-05-11 21:42:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class bad_typeid
|
|
|
|
: public exception
|
|
|
|
{
|
|
|
|
public:
|
2011-05-26 20:23:59 +02:00
|
|
|
bad_typeid() noexcept;
|
|
|
|
bad_typeid(const bad_typeid&) noexcept;
|
|
|
|
bad_typeid& operator=(const bad_typeid&) noexcept;
|
|
|
|
virtual const char* what() const noexcept;
|
2010-05-11 21:42:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // std
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <__config>
|
|
|
|
#include <exception>
|
|
|
|
#include <cstddef>
|
|
|
|
|
2011-10-17 22:05:10 +02:00
|
|
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
2010-05-11 21:42:16 +02:00
|
|
|
#pragma GCC system_header
|
2011-10-17 22:05:10 +02:00
|
|
|
#endif
|
2010-05-11 21:42:16 +02:00
|
|
|
|
|
|
|
namespace std // purposefully not using versioning namespace
|
|
|
|
{
|
|
|
|
|
2010-08-22 02:02:43 +02:00
|
|
|
class _LIBCPP_EXCEPTION_ABI type_info
|
2010-05-11 21:42:16 +02:00
|
|
|
{
|
|
|
|
type_info& operator=(const type_info&);
|
|
|
|
type_info(const type_info&);
|
|
|
|
protected:
|
|
|
|
const char* __type_name;
|
|
|
|
|
2010-09-23 20:58:28 +02:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-11 21:42:16 +02:00
|
|
|
explicit type_info(const char* __n)
|
|
|
|
: __type_name(__n) {}
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual ~type_info();
|
|
|
|
|
2010-09-23 20:58:28 +02:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2011-05-26 20:23:59 +02:00
|
|
|
const char* name() const _NOEXCEPT {return __type_name;}
|
2010-05-11 21:42:16 +02:00
|
|
|
|
2010-09-23 20:58:28 +02:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2011-05-26 20:23:59 +02:00
|
|
|
bool before(const type_info& __arg) const _NOEXCEPT
|
2010-05-11 21:42:16 +02:00
|
|
|
{return __type_name < __arg.__type_name;}
|
2010-09-23 20:58:28 +02:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2011-05-26 20:23:59 +02:00
|
|
|
size_t hash_code() const _NOEXCEPT
|
2010-05-11 21:42:16 +02:00
|
|
|
{return *reinterpret_cast<const size_t*>(&__type_name);}
|
|
|
|
|
2010-09-23 20:58:28 +02:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2011-05-26 20:23:59 +02:00
|
|
|
bool operator==(const type_info& __arg) const _NOEXCEPT
|
2010-05-11 21:42:16 +02:00
|
|
|
{return __type_name == __arg.__type_name;}
|
2010-09-23 20:58:28 +02:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2011-05-26 20:23:59 +02:00
|
|
|
bool operator!=(const type_info& __arg) const _NOEXCEPT
|
2010-05-11 21:42:16 +02:00
|
|
|
{return !operator==(__arg);}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2010-05-14 22:19:37 +02:00
|
|
|
class _LIBCPP_EXCEPTION_ABI bad_cast
|
2010-08-22 02:02:43 +02:00
|
|
|
: public exception
|
2010-05-11 21:42:16 +02:00
|
|
|
{
|
|
|
|
public:
|
2011-05-26 20:23:59 +02:00
|
|
|
bad_cast() _NOEXCEPT;
|
|
|
|
virtual ~bad_cast() _NOEXCEPT;
|
|
|
|
virtual const char* what() const _NOEXCEPT;
|
2010-05-11 21:42:16 +02:00
|
|
|
};
|
|
|
|
|
2010-05-14 22:19:37 +02:00
|
|
|
class _LIBCPP_EXCEPTION_ABI bad_typeid
|
2010-08-22 02:02:43 +02:00
|
|
|
: public exception
|
2010-05-11 21:42:16 +02:00
|
|
|
{
|
|
|
|
public:
|
2011-05-26 20:23:59 +02:00
|
|
|
bad_typeid() _NOEXCEPT;
|
|
|
|
virtual ~bad_typeid() _NOEXCEPT;
|
|
|
|
virtual const char* what() const _NOEXCEPT;
|
2010-05-11 21:42:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // std
|
|
|
|
|
|
|
|
#endif // __LIBCPP_TYPEINFO
|