2010-05-12 03:42:16 +08:00
|
|
|
// -*- C++ -*-
|
|
|
|
//===-------------------------- typeinfo ----------------------------------===//
|
|
|
|
//
|
2010-05-12 05:36:01 +08:00
|
|
|
// The LLVM Compiler Infrastructure
|
2010-05-12 03:42:16 +08:00
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef __LIBCPP_TYPEINFO
|
|
|
|
#define __LIBCPP_TYPEINFO
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
typeinfo synopsis
|
|
|
|
|
|
|
|
namespace std {
|
|
|
|
|
|
|
|
class type_info
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~type_info();
|
|
|
|
|
|
|
|
bool operator==(const type_info& rhs) const;
|
|
|
|
bool operator!=(const type_info& rhs) const;
|
|
|
|
|
|
|
|
bool before(const type_info& rhs) const;
|
|
|
|
size_t hash_code() const throw();
|
|
|
|
const char* name() const;
|
|
|
|
|
|
|
|
type_info(const type_info& rhs) = delete;
|
|
|
|
type_info& operator=(const type_info& rhs) = delete;
|
|
|
|
};
|
|
|
|
|
|
|
|
class bad_cast
|
|
|
|
: public exception
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bad_cast() throw();
|
|
|
|
bad_cast(const bad_cast&) throw();
|
|
|
|
bad_cast& operator=(const bad_cast&) throw();
|
|
|
|
virtual const char* what() const throw();
|
|
|
|
};
|
|
|
|
|
|
|
|
class bad_typeid
|
|
|
|
: public exception
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bad_typeid() throw();
|
|
|
|
bad_typeid(const bad_typeid&) throw();
|
|
|
|
bad_typeid& operator=(const bad_typeid&) throw();
|
|
|
|
virtual const char* what() const throw();
|
|
|
|
};
|
|
|
|
|
|
|
|
} // std
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <__config>
|
|
|
|
#include <exception>
|
|
|
|
#include <cstddef>
|
|
|
|
|
|
|
|
#pragma GCC system_header
|
|
|
|
|
|
|
|
|
|
|
|
namespace std // purposefully not using versioning namespace
|
|
|
|
{
|
|
|
|
|
2010-05-15 04:19:37 +08:00
|
|
|
class _LIBCPP_EXCEPTION_ABI type_info
|
2010-05-12 03:42:16 +08:00
|
|
|
{
|
|
|
|
type_info& operator=(const type_info&);
|
|
|
|
type_info(const type_info&);
|
|
|
|
protected:
|
|
|
|
const char* __type_name;
|
|
|
|
|
|
|
|
explicit type_info(const char* __n)
|
|
|
|
: __type_name(__n) {}
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual ~type_info();
|
|
|
|
|
|
|
|
const char* name() const {return __type_name;}
|
|
|
|
|
|
|
|
bool before(const type_info& __arg) const
|
|
|
|
{return __type_name < __arg.__type_name;}
|
|
|
|
size_t hash_code() const throw()
|
|
|
|
{return *reinterpret_cast<const size_t*>(&__type_name);}
|
|
|
|
|
|
|
|
bool operator==(const type_info& __arg) const
|
|
|
|
{return __type_name == __arg.__type_name;}
|
|
|
|
bool operator!=(const type_info& __arg) const
|
|
|
|
{return !operator==(__arg);}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2010-05-15 04:19:37 +08:00
|
|
|
class _LIBCPP_EXCEPTION_ABI bad_cast
|
2010-05-12 03:42:16 +08:00
|
|
|
: public exception
|
|
|
|
{
|
|
|
|
public:
|
2010-05-15 04:19:37 +08:00
|
|
|
bad_cast() throw();
|
2010-05-12 03:42:16 +08:00
|
|
|
virtual ~bad_cast() throw();
|
|
|
|
virtual const char* what() const throw();
|
|
|
|
};
|
|
|
|
|
2010-05-15 04:19:37 +08:00
|
|
|
class _LIBCPP_EXCEPTION_ABI bad_typeid
|
2010-05-12 03:42:16 +08:00
|
|
|
: public exception
|
|
|
|
{
|
|
|
|
public:
|
2010-05-15 04:19:37 +08:00
|
|
|
bad_typeid() throw();
|
2010-05-12 03:42:16 +08:00
|
|
|
virtual ~bad_typeid() throw();
|
|
|
|
virtual const char* what() const throw();
|
|
|
|
};
|
|
|
|
|
2010-05-15 04:19:37 +08:00
|
|
|
|
2010-05-12 03:42:16 +08:00
|
|
|
} // std
|
|
|
|
|
2010-05-15 04:19:37 +08:00
|
|
|
|
2010-05-12 03:42:16 +08:00
|
|
|
|
|
|
|
#endif // __LIBCPP_TYPEINFO
|