Embedded Template Library
1.0
Loading...
Searching...
No Matches
to_u8string.h
Go to the documentation of this file.
1
2
3
/******************************************************************************
4
The MIT License(MIT)
5
6
Embedded Template Library.
7
https://github.com/ETLCPP/etl
8
https://www.etlcpp.com
9
10
Copyright(c) 2019 John Wellbelove
11
12
Permission is hereby granted, free of charge, to any person obtaining a copy
13
of this software and associated documentation files(the "Software"), to deal
14
in the Software without restriction, including without limitation the rights
15
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
16
copies of the Software, and to permit persons to whom the Software is
17
furnished to do so, subject to the following conditions :
18
19
The above copyright notice and this permission notice shall be included in all
20
copies or substantial portions of the Software.
21
22
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
25
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
SOFTWARE.
29
******************************************************************************/
30
31
#ifndef ETL_TO_U8STRING_INCLUDED
32
#define ETL_TO_U8STRING_INCLUDED
33
35
36
#include "
platform.h
"
37
#include "
type_traits.h
"
38
#include "
u8string.h
"
39
#include "
u8format_spec.h
"
40
#include "
private/to_string_helper.h
"
41
42
namespace
etl
43
{
44
//***************************************************************************
47
//***************************************************************************
48
template
<
typename
T>
49
typename
etl::enable_if<!etl::is_same<T, etl::iu8string>::value
&& !
etl::is_same<T, etl::u8string_view>::value
,
const
etl::iu8string
&>::type
50
to_string
(
const
T
value,
etl::iu8string
& str,
bool
append =
false
)
51
{
52
etl::u8format_spec
format;
53
54
return
private_to_string::to_string(value, str, format, append);
55
}
56
57
//***************************************************************************
60
//***************************************************************************
61
template
<
typename
T>
62
typename
etl::enable_if<!etl::is_same<T, etl::iu8string>::value
&& !
etl::is_same<T, etl::u8string_view>::value
,
const
etl::iu8string
&>::type
63
to_string
(
const
T
value,
etl::iu8string
& str,
const
etl::u8format_spec
& format,
bool
append =
false
)
64
{
65
return
private_to_string::to_string(value, str, format, append);
66
}
67
68
//***************************************************************************
71
//***************************************************************************
72
template
<
typename
T>
73
typename
etl::enable_if<!etl::is_same<T, etl::iu8string>::value
&& !
etl::is_same<T, etl::u8string_view>::value
,
const
etl::iu8string
&>::type
74
to_string
(
const
T
value,
uint32_t
denominator_exponent
,
etl::iu8string
& str,
bool
append =
false
)
75
{
76
etl::u8format_spec
format;
77
78
return
private_to_string::to_string(value,
denominator_exponent
, str, format, append);
79
}
80
81
//***************************************************************************
84
//***************************************************************************
85
template
<
typename
T>
86
typename
etl::enable_if<!etl::is_same<T, etl::iu8string>::value
&& !
etl::is_same<T, etl::u8string_view>::value
,
const
etl::iu8string
&>::type
87
to_string
(
const
T
value,
uint32_t
denominator_exponent
,
etl::iu8string
& str,
const
etl::u8format_spec
& format,
bool
append =
false
)
88
{
89
return
private_to_string::to_string(value,
denominator_exponent
, str, format, append);
90
}
91
92
93
//***************************************************************************
96
//***************************************************************************
97
template
<
typename
T>
98
typename
etl::enable_if<etl::is_same<T, etl::iu8string>::value
,
const
etl::iu8string
&>::type
99
to_string
(
const
T
& value,
etl::iu8string
& str,
bool
append =
false
)
100
{
101
etl::u8format_spec
format;
102
103
private_to_string::add_string(value, str, format, append);
104
105
return
str;
106
}
107
108
//***************************************************************************
111
//***************************************************************************
112
template
<
typename
T>
113
typename
etl::enable_if<etl::is_same<T, etl::iu8string>::value
,
const
etl::iu8string
&>::type
114
to_string
(
const
etl::iu8string
& value,
T
& str,
const
etl::u8format_spec
& format,
bool
append =
false
)
115
{
116
private_to_string::add_string(value, str, format, append);
117
118
return
str;
119
}
120
121
//***************************************************************************
124
//***************************************************************************
125
template
<
typename
T>
126
typename
etl::enable_if<etl::is_same<T, etl::u8string_view>::value
,
const
etl::iu8string
&>::type
127
to_string
(
T
value,
etl::iu8string
& str,
bool
append =
false
)
128
{
129
etl::u8format_spec
format;
130
131
private_to_string::add_string_view(value, str, format, append);
132
133
return
str;
134
}
135
136
//***************************************************************************
139
//***************************************************************************
140
template
<
typename
T>
141
typename
etl::enable_if<etl::is_same<T, etl::u8string_view>::value
,
const
etl::iu8string
&>::type
142
to_string
(
T
value,
etl::iu8string
& str,
const
etl::u8format_spec
& format,
bool
append =
false
)
143
{
144
private_to_string::add_string_view(value, str, format, append);
145
146
return
str;
147
}
148
}
149
150
#endif
etl::ibasic_string
Definition
basic_string.h:326
etl::is_same
is_same
Definition
type_traits_generator.h:1041
etl
bitset_ext
Definition
absolute.h:38
etl::to_string
etl::enable_if<!etl::is_same< T, etl::istring >::value &&!etl::is_same< T, etl::string_view >::value, constetl::istring & >::type to_string(const T value, etl::istring &str, bool append=false)
Definition
to_string.h:50
platform.h
etl::pair
pair holds two objects of arbitrary type
Definition
utility.h:164
to_string_helper.h
type_traits.h
u8format_spec.h
u8string.h
include
etl
to_u8string.h
Generated on Sat Jan 11 2025 23:21:45 for Embedded Template Library by
1.9.8