File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
rosidl_runtime_cpp/include/rosidl_runtime_cpp Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -129,14 +129,20 @@ inline void value_to_yaml(const std::string & value, std::ostream & out)
129
129
inline void value_to_yaml (const std::u16string & value, std::ostream & out)
130
130
{
131
131
out << " \" " ;
132
+ #if __cplusplus < 201703L
132
133
std::wstring_convert<std::codecvt_utf8_utf16<char16_t >, char16_t > convert;
134
+ #endif
133
135
auto flags = out.flags ();
134
136
size_t index = 0 ;
135
137
while (index < value.size ()) {
136
138
uint_least16_t character = static_cast <uint_least16_t >(value[index]);
137
139
if (!(character & 0xff80 )) { // ASCII
140
+ #if __cplusplus < 201703L
138
141
std::string character_as_string = convert.to_bytes (character);
139
142
out << std::hex << character_as_string.c_str ();
143
+ #else
144
+ out << static_cast <char >(character);
145
+ #endif
140
146
} else if (!(character & 0xff00 )) { // only 1 byte set
141
147
out << " \\ x" << std::hex << std::setw (2 ) << std::setfill (' 0' ) << \
142
148
character;
You can’t perform that action at this time.
0 commit comments