xtd 1.0.0
Loading...
Searching...
No Matches
type_object.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "iequatable.hpp"
6#include "object.hpp"
7#include "ptr.hpp"
8#include "ref.hpp"
9#include "type.hpp"
10#include "string.hpp"
11
13namespace xtd {
14 class type_object;
15
16 template<typename type_t> auto type_of() noexcept -> const xtd::type_object&;
17 auto type_of(const auto& value) noexcept -> xtd::type_object;
18 auto type_of(const xtd::type& value) noexcept -> xtd::type_object;
19}
21
22
24namespace xtd {
26
39 class type_object : public xtd::object, public xtd::iequatable<type_object> {
40 public:
46 [[nodiscard]] auto full_name() const noexcept -> xtd::string;
47
51 [[nodiscard]] auto name() const noexcept -> xtd::string;
52
56 [[nodiscard]] auto namespace_() const noexcept -> xtd::string;
58
64 [[nodiscard]] auto equals(const xtd::object& obj) const noexcept -> bool override;
68 [[nodiscard]] auto equals(const type_object& type) const noexcept -> bool override;
69
72 [[nodiscard]] auto get_hash_code() const noexcept -> xtd::usize override;
73
76 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
78
79 private:
80 template<typename type_t>
81 friend auto xtd::type_of() noexcept -> const type_object&;
82 friend auto xtd::type_of(const auto& value) noexcept -> type_object;
83 friend auto xtd::type_of(const xtd::type& value) noexcept -> type_object;
84 friend class xtd::object;
85
86 type_object() noexcept;
87 type_object(const xtd::type& type) noexcept;
88
89 xtd::ptr<xtd::ref<const xtd::type>> type_;
90 };
91
92}
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:45
Represents type declarations: class types, interface types, array types, value types,...
Definition type_object.hpp:39
auto namespace_() const noexcept -> xtd::string
Gets the namespace of the type_object.
auto to_string() const noexcept -> xtd::string override
Returns a xtd::string that represents the current object.
auto name() const noexcept -> xtd::string
Gets the name of the type_object.
auto get_hash_code() const noexcept -> xtd::usize override
Serves as a hash function for a particular type.
auto equals(const xtd::object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
auto full_name() const noexcept -> xtd::string
Gets the fully qualified name of the type_object, including the namespace of the type_object.
std::type_info type
Stores information about a type.
Definition type.hpp:23
xtd::reference_wrapper_object< type_t > ref
The xtd::ref object is a reference wrapper.
Definition ref.hpp:25
xtd::sptr< type_t > ptr
The xtd::ptr object is a shared pointer.
Definition ptr.hpp:27
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
Contains xtd::iequatable interface.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::object class.
Contains xtd::ptr type.
Contains xtd::ref type.
Contains xtd::string alias.
Contains xtd::type type.