diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-12-16 20:29:05 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2021-02-24 16:40:04 +0300 |
commit | 8e761289a2446367267c6c0d9a26e734f0f78306 (patch) | |
tree | fb495d8c18801f271d124ee48731f10df396ca89 /libcutl/compiler/type-info.hxx | |
parent | 4c8104756b92b9fa16b3a725e8a6aa620dfd606e (diff) |
Get rid of legacy build systems and rename cutl/ to libcutl/
Diffstat (limited to 'libcutl/compiler/type-info.hxx')
-rw-r--r-- | libcutl/compiler/type-info.hxx | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/libcutl/compiler/type-info.hxx b/libcutl/compiler/type-info.hxx new file mode 100644 index 0000000..4263a41 --- /dev/null +++ b/libcutl/compiler/type-info.hxx @@ -0,0 +1,110 @@ +// file : libcutl/compiler/type-info.hxx +// license : MIT; see accompanying LICENSE file + +#ifndef LIBCUTL_COMPILER_TYPE_INFO_HXX +#define LIBCUTL_COMPILER_TYPE_INFO_HXX + +#include <map> +#include <vector> +#include <typeinfo> // std::type_info + +#include <libcutl/exception.hxx> +#include <libcutl/static-ptr.hxx> +#include <libcutl/compiler/type-id.hxx> + +#include <libcutl/export.hxx> + +namespace cutl +{ + namespace compiler + { + // + // + class type_info; + typedef type_info type_info_t; + + + // + // + class base_info + { + public: + base_info (type_id const&); + + public: + type_info_t const& + type_info () const; + + private: + type_id type_id_; + mutable type_info_t const* type_info_; + }; + + typedef base_info base_info_t; + + + // + // + class type_info + { + typedef std::vector<base_info> bases; + + public: + typedef + bases::const_iterator + base_iterator; + + public: + type_info (type_id_t const&); + + type_id_t + type_id () const; + + base_iterator + begin_base () const; + + base_iterator + end_base () const; + + void + add_base (type_id_t const&); + + private: + type_id_t type_id_; + bases bases_; + }; + + + // + // + class no_type_info: exception {}; + + LIBCUTL_EXPORT type_info const& + lookup (type_id const&); + + type_info const& + lookup (std::type_info const&); + + template <typename X> + type_info const& + lookup (X const volatile&); + + template<typename X> + type_info const& + lookup (); + + LIBCUTL_EXPORT void + insert (type_info const&); + + namespace bits + { + struct default_type_info_id {}; + typedef std::map<type_id, type_info> type_info_map; + static static_ptr<type_info_map, default_type_info_id> type_info_map_; + } + } +} + +#include <libcutl/compiler/type-info.ixx> + +#endif // LIBCUTL_COMPILER_TYPE_INFO_HXX |