33 template<
typename type_t>
34 static const type_t&
to_ref(
const type_t& value) {
50 template<
typename type_t>
51 static type_t&
to_ref(type_t& value) {
66 template<
typename type_t>
67 static const type_t&
to_ref(
const type_t* value) {
82 template<
typename type_t>
83 static type_t&
to_ref(type_t* value) {
99 template<
typename new_type_t,
typename current_type_t>
100 static const new_type_t&
to_ref(
const current_type_t& value) {
102 return dynamic_cast<const new_type_t&
>(value);
103 }
catch (
const std::exception&
e) {
121 template<
typename new_type_t,
typename current_type_t>
122 static new_type_t&
to_ref(current_type_t& value) {
124 return dynamic_cast<new_type_t&
>(value);
125 }
catch (
const std::exception&
e) {
143 template<
typename new_type_t,
typename current_type_t>
144 static const new_type_t&
to_ref(
const current_type_t* value) {
146 return dynamic_cast<const new_type_t&
>(*value);
147 }
catch (
const std::exception&
e) {
165 template<
typename new_type_t,
typename current_type_t>
166 static new_type_t&
to_ref(current_type_t* value) {
168 return dynamic_cast<new_type_t&
>(*value);
169 }
catch (
const std::exception&
e) {
186 template<
typename type_t>
187 static const type_t*
to_ptr(
const type_t* value) {
202 template<
typename type_t>
218 template<
typename new_type_t,
typename current_type_t>
219 static const new_type_t*
to_ptr(
const current_type_t* value) {
220 if (value ==
nullptr)
return nullptr;
221 return &to_ref<new_type_t>(*value);
235 template<
typename new_type_t,
typename current_type_t>
236 static new_type_t*
to_ptr(current_type_t* value) {
237 if (value ==
nullptr)
return nullptr;
238 return &to_ref<new_type_t>(*value);
252 template<
typename new_type_t,
typename current_type_t>
253 static const new_type_t*
to_ptr(
const current_type_t& value) {
254 if (value ==
nullptr)
return nullptr;
255 return &to_ref<new_type_t>(value);
269 template<
typename new_type_t,
typename current_type_t>
270 static new_type_t*
to_ptr(current_type_t& value) {
271 if (value ==
nullptr)
return nullptr;
272 return &to_ref<new_type_t>(value);
287 template<
typename new_type_t,
typename current_type_t>
288 static std::unique_ptr<new_type_t>
to_unique_ptr(std::unique_ptr<current_type_t>& value) {
291 return std::unique_ptr<new_type_t>(as<new_type_t>(value.release()));
292 }
catch (
const std::exception&
e) {
309 template<
typename new_type_t,
typename current_type_t>
310 static std::unique_ptr<new_type_t>
to_unique_ptr(std::unique_ptr<current_type_t>&& value) {
313 return std::unique_ptr<new_type_t>(as<new_type_t>(value.release()));
314 }
catch (
const std::exception&
e) {
332 template<
typename new_type_t,
typename current_type_t>
333 static std::shared_ptr<new_type_t>
to_shared_ptr(
const std::shared_ptr<current_type_t>& value) {
335 return dynamic_pointer_cast<new_type_t>(value);
336 }
catch (
const std::exception&
e) {
353 template<
typename new_type_t,
typename current_type_t>
354 static std::shared_ptr<new_type_t>
to_shared_ptr(std::shared_ptr<current_type_t>& value) {
356 return dynamic_pointer_cast<new_type_t>(value);
357 }
catch (
const std::exception&
e) {
375 template<
typename new_type_t,
typename current_type_t>
376 static std::shared_ptr<new_type_t>
to_shared_ptr(std::shared_ptr<current_type_t>&& value) {
379 }
catch (
const std::exception&
e) {
Represents API to convert pointers.
Definition: convert_pointer.h:19
The exception that is thrown for invalid casting or explicit conversion.
Definition: invalid_cast_exception.h:18
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition: static.h:38
#define csf_
Provides information about the current stack frame.
Definition: stack_frame.h:213
static const new_type_t * to_ptr(const current_type_t &value)
Casts a type into another type.
Definition: convert_pointer.h:253
static const type_t * to_ptr(const type_t *value)
Casts a type into another type.
Definition: convert_pointer.h:187
static type_t & to_ref(type_t *value)
Casts a type into another type.
Definition: convert_pointer.h:83
static std::unique_ptr< new_type_t > to_unique_ptr(std::unique_ptr< current_type_t > &&value)
Casts a type into another type.
Definition: convert_pointer.h:310
static const new_type_t * to_ptr(const current_type_t *value)
Casts a type into another type.
Definition: convert_pointer.h:219
static new_type_t & to_ref(current_type_t *value)
Casts a type into another type.
Definition: convert_pointer.h:166
static type_t * to_ptr(type_t *value)
Casts a type into another type.
Definition: convert_pointer.h:203
static std::shared_ptr< new_type_t > to_shared_ptr(std::shared_ptr< current_type_t > &value)
Casts a type into another type.
Definition: convert_pointer.h:354
static new_type_t * to_ptr(current_type_t &value)
Casts a type into another type.
Definition: convert_pointer.h:270
static const type_t & to_ref(const type_t *value)
Casts a type into another type.
Definition: convert_pointer.h:67
static const type_t & to_ref(const type_t &value)
Casts a type into another type.
Definition: convert_pointer.h:34
static new_type_t * to_ptr(current_type_t *value)
Casts a type into another type.
Definition: convert_pointer.h:236
static const new_type_t & to_ref(const current_type_t &value)
Casts a type into another type.
Definition: convert_pointer.h:100
static std::shared_ptr< new_type_t > to_shared_ptr(const std::shared_ptr< current_type_t > &value)
Casts a type into another type.
Definition: convert_pointer.h:333
static const new_type_t & to_ref(const current_type_t *value)
Casts a type into another type.
Definition: convert_pointer.h:144
static std::shared_ptr< new_type_t > to_shared_ptr(std::shared_ptr< current_type_t > &&value)
Casts a type into another type.
Definition: convert_pointer.h:376
static type_t & to_ref(type_t &value)
Casts a type into another type.
Definition: convert_pointer.h:51
static new_type_t & to_ref(current_type_t &value)
Casts a type into another type.
Definition: convert_pointer.h:122
static std::unique_ptr< new_type_t > to_unique_ptr(std::unique_ptr< current_type_t > &value)
Casts a type into another type.
Definition: convert_pointer.h:288
Contains xtd::invalid_cast_exception exception.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::static_object class.
Contains xtd fundamental types.