Loading...
Searching...
No Matches
typeProvidable.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include "meta/common.hpp"
5#include "meta/type/ttype.hpp"
6
7namespace by {
13 class _nout typeProvidable {
15
16 public:
17 nbool operator==(const me& rhs) const;
18 nbool operator!=(const me& rhs) const;
19
20 public:
21 virtual const type& getType() const = 0;
22
23 nbool isSub(const type& it) const;
24 nbool isSub(const type* it) const BY_SIDE_FUNC(isSub);
25 nbool isSub(const me& it) const;
26 nbool isSub(const me* it) const BY_SIDE_FUNC(isSub);
27
28 nbool isSuper(const type& it) const;
29 nbool isSuper(const type* it) const BY_SIDE_FUNC(isSuper);
30 nbool isSuper(const me& it) const;
31
32 nbool isSuper(const me* it) const BY_SIDE_FUNC(isSuper);
33
34 template <typename T> nint isSub() const { return getType().isSub<T>(); }
35
36 template <typename T> nint isSuper() const { return getType().isSuper<T>(); }
37
38 template <typename T> T* cast() { return (T*) cast(ttype<T>::get()); }
39
40 template <typename T> const T* cast() const BY_CONST_FUNC(cast<T>())
41
47 virtual void* cast(const type& to);
48 const void* cast(const type& to) const BY_CONST_FUNC(cast(to))
49 void* cast(const type* it) BY_SIDE_FUNC(cast);
50 const void* cast(const type* to) const BY_CONST_FUNC(cast(to))
51
53 virtual nbool _onSame(const me& rhs) const;
54 };
55} // namespace by
Template type wrapper providing entry point for meta information.
Definition ttype.hpp:37
Core class for runtime type information in byeol language.
Definition type.hpp:100
Interface for objects that can provide their type information.
Definition typeProvidable.hpp:13
const T * cast() const BY_CONST_FUNC(cast< T >()) virtual void *cast(const type &to)
Safe cast to target type using type hierarchy information.
Rich logging support with polymorphic type conversion.
Definition richLog.hpp:34