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_object.h"
7#include "char_object.h"
8#include "char16_object.h"
9#include "char32_object.h"
10#include "char8_object.h"
11#include "decimal_object.h"
12#include "double_object.h"
13#include "int16_object.h"
14#include "int32_object.h"
15#include "int64_object.h"
16#include "intptr_object.h"
17#include "ptrdiff_object.h"
18#include "sbyte_object.h"
19#include "single_object.h"
20#include "size_object.h"
21#include "slong_object.h"
22#include "uint16_object.h"
23#include "uint32_object.h"
24#include "uint64_object.h"
25#include "uintptr_object.h"
26#include "ulong_object.h"
27#include "wchar_object.h"
28#define __XTD_CORE_INTERNAL__
30#undef __XTD_CORE_INTERNAL__
31
33namespace xtd {
48 template<typename type_t>
49 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);}
64 template<typename type_t, typename ...args_t>
65 inline box<type_t> boxing(args_t&& ...args) noexcept {return box<type_t>(args...);}
66
68 inline const object& boxing(const object& value) noexcept {return value;}
69 inline string boxing(const char* value) noexcept {return string(value);}
70#if defined(__xtd__cpp_lib_char8_t)
71 inline string boxing(const char8* value) noexcept {return string(value);}
72#endif
73 inline string boxing(const char16* value) noexcept {return string(value);}
74 inline string boxing(const char32* value) noexcept {return string(value);}
75 inline string boxing(const wchar* value) noexcept {return string(value);}
76 inline char_object boxing(const char& value) noexcept {return char_object(value);}
77#if defined(__xtd__cpp_lib_char8_t)
78 inline char8_object boxing(const char8& value) noexcept {return char8_object(value);}
79#endif
80 inline char16_object boxing(const char16& value) noexcept {return char16_object(value);}
81 inline char32_object boxing(const char32& value) noexcept {return char32_object(value);}
82 inline wchar_object boxing(const wchar& value) noexcept {return wchar_object(value);}
83 inline char_object boxing(char& value) noexcept {return char_object(value);}
84#if defined(__xtd__cpp_lib_char8_t)
85 inline char8_object boxing(char8& value) noexcept {return char8_object(value);}
86#endif
87 inline char16_object boxing(char16& value) noexcept {return char16_object(value);}
88 inline char32_object boxing(char32& value) noexcept {return char32_object(value);}
89 inline wchar_object boxing(wchar& value) noexcept {return wchar_object(value);}
90 inline byte_object boxing(const xtd::byte& value) noexcept {return byte_object(value);}
91 inline int16_object boxing(const int16& value) noexcept {return int16_object(value);}
92 inline int32_object boxing(const int32& value) noexcept {return int32_object(value);}
93 inline int64_object boxing(const int64& value) noexcept {return int64_object(value);}
94 inline slong_object boxing(const slong& value) noexcept {return slong_object(value);}
95 inline sbyte_object boxing(const sbyte& value) noexcept {return sbyte_object(value);}
96 inline uint16_object boxing(const uint16& value) noexcept {return uint16_object(value);}
97 inline uint32_object boxing(const uint32& value) noexcept {return uint32_object(value);}
98 inline uint64_object boxing(const uint64& value) noexcept {return uint64_object(value);}
99 inline ulong_object boxing(const xtd::ulong& value) noexcept {return ulong_object(value);}
100 inline byte_object boxing(xtd::byte& value) noexcept {return byte_object(value);}
101 inline int16_object boxing(int16& value) noexcept {return int16_object(value);}
102 inline int32_object boxing(int32& value) noexcept {return int32_object(value);}
103 inline int64_object boxing(int64& value) noexcept {return int64_object(value);}
104 inline slong_object boxing(slong& value) noexcept {return slong_object(value);}
105 inline sbyte_object boxing(sbyte& value) noexcept {return sbyte_object(value);}
106 inline uint16_object boxing(uint16& value) noexcept {return uint16_object(value);}
107 inline uint32_object boxing(uint32& value) noexcept {return uint32_object(value);}
108 inline uint64_object boxing(uint64& value) noexcept {return uint64_object(value);}
109 inline ulong_object boxing(xtd::ulong& value) noexcept {return ulong_object(value);}
110 inline single_object boxing(const float& value) noexcept {return single_object(value);}
111 inline double_object boxing(const double& value) noexcept {return double_object(value);}
112 inline decimal_object boxing(const decimal& value) noexcept {return decimal_object(value);}
113 inline single_object boxing(float& value) noexcept {return single_object(value);}
114 inline double_object boxing(double& value) noexcept {return double_object(value);}
115 inline decimal_object boxing(decimal& value) noexcept {return decimal_object(value);}
117}
Contains box_enum_or_object struct.
Contains xtd::box class.
Contains xtd::byte_object alias.
Contains xtd::char16_object alias.
Contains xtd::char32_object alias.
Contains xtd::char8_object alias.
Contains xtd::char_object alias.
Represents a boxed object.
Definition box.h:53
Contains xtd::decimal_object alias.
Contains xtd::double_object alias.
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.h:43
auto boxing(const type_t &value) noexcept
Allows to box an object.
Definition boxing.h:49
int16_t int16
Represents a 16-bit signed integer.
Definition int16.h:23
char8_t char8
Represents a 8-bit unicode character.
Definition char8.h:27
wchar_t wchar
Represents a wide character.
Definition wchar.h:24
int32_t int32
Represents a 32-bit signed integer.
Definition int32.h:23
long double decimal
Represents a decimal-precision floating-point number.
Definition decimal.h:23
box_floating_point< decimal > decimal_object
Represent a boxed decimal.
Definition decimal_object.h:33
int64_t int64
Represents a 64-bit signed integer.
Definition int64.h:23
__ulong__ ulong
Represents a 32-bit or 64-bit unsigned integer.
Definition ulong.h:27
int8_t sbyte
Represents a 8-bit signed integer.
Definition sbyte.h:23
char16_t char16
Represents a 16-bit unicode character.
Definition char16.h:26
box_char< char32 > char32_object
Represent a boxed char32.
Definition char32_object.h:33
box_char< char16 > char16_object
Represent a boxed char16.
Definition char16_object.h:33
uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.h:23
box_integer< slong > slong_object
Represent a boxed int16.
Definition slong_object.h:29
box_integer< int16 > int16_object
Represent a boxed int16.
Definition int16_object.h:29
box_integer< int32 > int32_object
Represent a boxed int32.
Definition int32_object.h:29
box_integer< uint16 > uint16_object
Represent a boxed uint16.
Definition uint16_object.h:29
box_char< char8 > char8_object
Represent a boxed char8.
Definition char8_object.h:34
box_floating_point< float > single_object
Represent a boxed single.
Definition single_object.h:29
box_integer< sbyte > sbyte_object
Represent a boxed sbyte.
Definition sbyte_object.h:29
box_integer< xtd::byte > byte_object
Represent a boxed byte.
Definition byte_object.h:33
char32_t char32
Represents a 32-bit unicode character.
Definition char32.h:26
box_floating_point< double > double_object
Represent a boxed double.
Definition double_object.h:33
box_char< char > char_object
Represent a boxed char.
Definition char_object.h:33
box_char< wchar > wchar_object
Represent a boxed wchar.
Definition wchar_object.h:33
box_integer< uint64 > uint64_object
Represent a boxed uint64.
Definition uint64_object.h:29
uint64_t uint64
Represents a 64-bit unsigned integer.
Definition uint64.h:23
box_integer< int64 > int64_object
Represent a boxed int64.
Definition int64_object.h:29
uint8_t byte
Represents a 8-bit unsigned integer.
Definition byte.h:23
box_integer< uint32 > uint32_object
Represent a boxed uint32.
Definition uint32_object.h:29
box_integer< ulong > ulong_object
Represent a boxed ulong.
Definition ulong_object.h:29
uint16_t uint16
Represents a 16-bit unsigned integer.
Definition uint16.h:23
__slong__ slong
Represents a 32-bit or 64-bit signed integer.
Definition slong.h:27
std::type_info type
Stores information about a type.
Definition type.h:23
Contains xtd::int16_object alias.
Contains xtd::int32_object alias.
Contains xtd::int64_object alias.
Contains xtd::intptr_object alias.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::intptr_object alias.
Contains xtd::sbyte_object alias.
Contains xtd::single_object alias.
Contains xtd::size_object alias.
Contains xtd::slong_object alias.
Contains xtd::uint16_object alias.
Contains xtd::uint32_object alias.
Contains xtd::uint64_object alias.
Contains xtd::uintptr_object alias.
Contains xtd::ulong_object alias.
Contains xtd::wchar_object alias.