xtd 0.2.0
Loading...
Searching...
No Matches
boxing.h
Go to the documentation of this file.
1
4#pragma once
5#include "box.h"
6#include "byte.h"
7#include "char.h"
8#include "char16.h"
9#include "char32.h"
10#include "char8.h"
11#include "decimal.h"
12#include "double.h"
13#include "int16.h"
14#include "int32.h"
15#include "int64.h"
16#include "intptr.h"
17#include "sbyte.h"
18#include "single.h"
19#include "size.h"
20#include "slong.h"
21#include "uint16.h"
22#include "uint32.h"
23#include "uint64.h"
24#include "uintptr.h"
25#include "ulong.h"
26#include "wchar.h"
27#define __XTD_CORE_INTERNAL__
28#include "internal/__box_enum_or_object.h"
29#undef __XTD_CORE_INTERNAL__
30
32namespace xtd {
45 template<typename type_t>
46 inline auto boxing(const type_t& value) noexcept {return typename __box_enum_or_object__<type_t, typename std::is_enum<type_t>::type>::type(value);}
59 template<typename type_t, typename ...args_t>
60 inline box<type_t> boxing(args_t&& ...args) noexcept {return box<type_t>(args...);}
61
63 inline const object& boxing(const object& value) noexcept {return value;}
64 inline ustring boxing(const char* value) noexcept {return ustring(value);}
65#if defined(__cpp_lib_char8_t)
66 inline ustring boxing(const char8* value) noexcept {return ustring(value);}
67#endif
68 inline ustring boxing(const char16* value) noexcept {return ustring(value);}
69 inline ustring boxing(const char32* value) noexcept {return ustring(value);}
70 inline ustring boxing(const wchar* value) noexcept {return ustring(value);}
71 inline char_object boxing(const char& value) noexcept {return char_object(value);}
72#if defined(__cpp_lib_char8_t)
73 inline char8_object boxing(const char8& value) noexcept {return char8_object(value);}
74#endif
75 inline char16_object boxing(const char16& value) noexcept {return char16_object(value);}
76 inline char32_object boxing(const char32& value) noexcept {return char32_object(value);}
77 inline wchar_object boxing(const wchar& value) noexcept {return wchar_object(value);}
78 inline char_object boxing(char& value) noexcept {return char_object(value);}
79#if defined(__cpp_lib_char8_t)
80 inline char8_object boxing(char8& value) noexcept {return char8_object(value);}
81#endif
82 inline char16_object boxing(char16& value) noexcept {return char16_object(value);}
83 inline char32_object boxing(char32& value) noexcept {return char32_object(value);}
84 inline wchar_object boxing(wchar& value) noexcept {return wchar_object(value);}
85 inline byte_object boxing(const xtd::byte& value) noexcept {return byte_object(value);}
86 inline int16_object boxing(const int16& value) noexcept {return int16_object(value);}
87 inline int32_object boxing(const int32& value) noexcept {return int32_object(value);}
88 inline int64_object boxing(const int64& value) noexcept {return int64_object(value);}
89 inline slong_object boxing(const slong& value) noexcept {return slong_object(value);}
90 inline sbyte_object boxing(const sbyte& value) noexcept {return sbyte_object(value);}
91 inline uint16_object boxing(const uint16& value) noexcept {return uint16_object(value);}
92 inline uint32_object boxing(const uint32& value) noexcept {return uint32_object(value);}
93 inline uint64_object boxing(const uint64& value) noexcept {return uint64_object(value);}
94 inline ulong_object boxing(const xtd::ulong& value) noexcept {return ulong_object(value);}
95 inline byte_object boxing(xtd::byte& value) noexcept {return byte_object(value);}
96 inline int16_object boxing(int16& value) noexcept {return int16_object(value);}
97 inline int32_object boxing(int32& value) noexcept {return int32_object(value);}
98 inline int64_object boxing(int64& value) noexcept {return int64_object(value);}
99 inline slong_object boxing(slong& value) noexcept {return slong_object(value);}
100 inline sbyte_object boxing(sbyte& value) noexcept {return sbyte_object(value);}
101 inline uint16_object boxing(uint16& value) noexcept {return uint16_object(value);}
102 inline uint32_object boxing(uint32& value) noexcept {return uint32_object(value);}
103 inline uint64_object boxing(uint64& value) noexcept {return uint64_object(value);}
104 inline ulong_object boxing(xtd::ulong& value) noexcept {return ulong_object(value);}
105 inline single_object boxing(const float& value) noexcept {return single_object(value);}
106 inline double_object boxing(const double& value) noexcept {return double_object(value);}
107 inline decimal_object boxing(const decimal& value) noexcept {return decimal_object(value);}
108 inline single_object boxing(float& value) noexcept {return single_object(value);}
109 inline double_object boxing(double& value) noexcept {return double_object(value);}
110 inline decimal_object boxing(decimal& value) noexcept {return decimal_object(value);}
112}
Contains xtd::box class.
Contains xtd::byte type and xtd::byte_object alias.
Contains xtd::char16 type and xtd::char16_object alias.
Contains xtd::char32 type and xtd::char32_object alias.
Contains xtd::char8 type and xtd::char8_object alias.
Contains xtd::char type and xtd::char_object alias.
Represents a boxed object.
Definition box.h:47
Contains xtd::decimal type and xtd::decimal_object alias.
Contains xtd::double type and xtd::double_object alias.
auto boxing(const type_t &value) noexcept
Allows to box an object.
Definition boxing.h:46
char8_t char8
Represents a 8-bit unicode character.
Definition types.h:64
wchar_t wchar
Represents a wide character.
Definition types.h:286
int_least16_t int16
Represents a 16-bit signed integer.
Definition types.h:120
long double decimal
Represents a decimal-precision floating-point number.
Definition types.h:98
box_floating_point< decimal > decimal_object
Represent a boxed decimal.
Definition decimal_object.h:30
__ulong__ ulong
Represents a 32-bit or 64-bit unsigned integer.
Definition types.h:274
char16_t char16
Represents a 16-bit unicode character.
Definition types.h:76
box_char< char32 > char32_object
Represent a boxed char32.
Definition char32_object.h:30
box_char< char16 > char16_object
Represent a boxed char16.
Definition char16_object.h:30
int_least8_t sbyte
Represents a 8-bit signed integer.
Definition types.h:175
box_integer< slong > slong_object
Represent a boxed int16.
Definition slong_object.h:28
box_integer< int16 > int16_object
Represent a boxed int16.
Definition int16_object.h:28
box_integer< int32 > int32_object
Represent a boxed int32.
Definition int32_object.h:28
box_integer< uint16 > uint16_object
Represent a boxed uint16.
Definition uint16_object.h:28
box_char< char8 > char8_object
Represent a boxed char8.
Definition char8_object.h:31
int_least64_t int64
Represents a 64-bit signed integer.
Definition types.h:142
uint_least16_t uint16
Represents a 16-bit unsigned integer.
Definition types.h:230
box_floating_point< float > single_object
Represent a boxed single.
Definition single_object.h:28
int_least32_t int32
Represents a 32-bit signed integer.
Definition types.h:131
box_integer< sbyte > sbyte_object
Represent a boxed sbyte.
Definition sbyte_object.h:28
box_integer< xtd::byte > byte_object
Represent a boxed byte.
Definition byte_object.h:30
char32_t char32
Represents a 32-bit unicode character.
Definition types.h:87
box_floating_point< double > double_object
Represent a boxed double.
Definition double_object.h:30
box_char< char > char_object
Represent a boxed char.
Definition char_object.h:30
box_char< wchar > wchar_object
Represent a boxed wchar.
Definition wchar_object.h:30
box_integer< uint64 > uint64_object
Represent a boxed uint64.
Definition uint64_object.h:28
box_integer< int64 > int64_object
Represent a boxed int64.
Definition int64_object.h:28
box_integer< uint32 > uint32_object
Represent a boxed uint32.
Definition uint32_object.h:28
box_integer< ulong > ulong_object
Represent a boxed ulong.
Definition ulong_object.h:28
uint_least64_t uint64
Represents a 64-bit unsigned integer.
Definition types.h:252
uint_least32_t uint32
Represents a 32-bit unsigned integer.
Definition types.h:241
__slong__ slong
Represents a 32-bit or 64-bit signed integer.
Definition types.h:208
uint_least8_t byte
Represents a 8-bit unsigned integer.
Definition types.h:41
std::type_info type
Stores information about a type.
Definition types.h:219
Contains xtd::int16 type and xtd::int16_object alias.
Contains xtd::int32 type and xtd::int32_object alias.
Contains xtd::int64 type and xtd::int64_object alias.
Contains xtd::intptr type and xtd::intptr_object alias.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::sbyte type and xtd::sbyte_object alias.
Contains xtd::single type and xtd::single_object alias.
Contains xtd::slong type and xtd::slong_object alias.
Contains xtd::uint16 type and xtd::uint16_object alias.
Contains xtd::uint32 type and xtd::uint32_object alias.
Contains xtd::uint64 type and xtd::uint64_object alias.
Contains xtd::uintptr type and xtd::uintptr_object alias.
Contains xtd::ulong type and xtd::ulong_object alias.
Contains xtd::wchar type and xtd::wchar_object alias.
Contains xtd::drawing::size class.