~ubuntu-branches/ubuntu/saucy/emscripten/saucy-proposed

« back to all changes in this revision

Viewing changes to system/include/libcxx/typeinfo

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- C++ -*-
 
2
//===-------------------------- typeinfo ----------------------------------===//
 
3
//
 
4
//                     The LLVM Compiler Infrastructure
 
5
//
 
6
// This file is dual licensed under the MIT and the University of Illinois Open
 
7
// Source Licenses. See LICENSE.TXT for details.
 
8
//
 
9
//===----------------------------------------------------------------------===//
 
10
 
 
11
#ifndef __LIBCPP_TYPEINFO
 
12
#define __LIBCPP_TYPEINFO
 
13
 
 
14
/*
 
15
 
 
16
    typeinfo synopsis
 
17
 
 
18
namespace std {
 
19
 
 
20
class type_info
 
21
{
 
22
public:
 
23
    virtual ~type_info();
 
24
 
 
25
    bool operator==(const type_info& rhs) const noexcept;
 
26
    bool operator!=(const type_info& rhs) const noexcept;
 
27
 
 
28
    bool before(const type_info& rhs) const noexcept;
 
29
    size_t hash_code() const noexcept;
 
30
    const char* name() const noexcept;
 
31
 
 
32
    type_info(const type_info& rhs) = delete;
 
33
    type_info& operator=(const type_info& rhs) = delete;
 
34
};
 
35
 
 
36
class bad_cast
 
37
    : public exception
 
38
{
 
39
public:
 
40
    bad_cast() noexcept;
 
41
    bad_cast(const bad_cast&) noexcept;
 
42
    bad_cast& operator=(const bad_cast&) noexcept;
 
43
    virtual const char* what() const noexcept;
 
44
};
 
45
 
 
46
class bad_typeid
 
47
    : public exception
 
48
{
 
49
public:
 
50
    bad_typeid() noexcept;
 
51
    bad_typeid(const bad_typeid&) noexcept;
 
52
    bad_typeid& operator=(const bad_typeid&) noexcept;
 
53
    virtual const char* what() const noexcept;
 
54
};
 
55
 
 
56
}  // std
 
57
 
 
58
*/
 
59
 
 
60
#include <__config>
 
61
#include <exception>
 
62
#include <cstddef>
 
63
 
 
64
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 
65
#pragma GCC system_header
 
66
#endif
 
67
 
 
68
namespace std  // purposefully not using versioning namespace
 
69
{
 
70
 
 
71
class _LIBCPP_EXCEPTION_ABI type_info
 
72
{
 
73
    type_info& operator=(const type_info&);
 
74
    type_info(const type_info&);
 
75
protected:
 
76
    const char* __type_name;
 
77
 
 
78
    _LIBCPP_INLINE_VISIBILITY
 
79
    explicit type_info(const char* __n)
 
80
        : __type_name(__n) {}
 
81
 
 
82
public:
 
83
    virtual ~type_info();
 
84
 
 
85
    _LIBCPP_INLINE_VISIBILITY
 
86
    const char* name() const _NOEXCEPT {return __type_name;}
 
87
 
 
88
    _LIBCPP_INLINE_VISIBILITY
 
89
    bool before(const type_info& __arg) const _NOEXCEPT
 
90
        {return __type_name < __arg.__type_name;}
 
91
    _LIBCPP_INLINE_VISIBILITY
 
92
    size_t hash_code() const _NOEXCEPT
 
93
        {return *reinterpret_cast<const size_t*>(&__type_name);}
 
94
 
 
95
    _LIBCPP_INLINE_VISIBILITY
 
96
    bool operator==(const type_info& __arg) const _NOEXCEPT
 
97
        {return __type_name == __arg.__type_name;}
 
98
    _LIBCPP_INLINE_VISIBILITY
 
99
    bool operator!=(const type_info& __arg) const _NOEXCEPT
 
100
        {return !operator==(__arg);}
 
101
 
 
102
};
 
103
 
 
104
class _LIBCPP_EXCEPTION_ABI bad_cast
 
105
    : public exception
 
106
{
 
107
public:
 
108
    bad_cast() _NOEXCEPT;
 
109
    virtual ~bad_cast() _NOEXCEPT;
 
110
    virtual const char* what() const _NOEXCEPT;
 
111
};
 
112
 
 
113
class _LIBCPP_EXCEPTION_ABI bad_typeid
 
114
    : public exception
 
115
{
 
116
public:
 
117
    bad_typeid() _NOEXCEPT;
 
118
    virtual ~bad_typeid() _NOEXCEPT;
 
119
    virtual const char* what() const _NOEXCEPT;
 
120
};
 
121
 
 
122
}  // std
 
123
 
 
124
#endif  // __LIBCPP_TYPEINFO