23 std::basic_string<unsigned int> value_str(1, value);
28 dest.append(utf8_value);
33 std::basic_string<unsigned int> &dest)
35 dest.push_back(value);
41 std::basic_string<T> dest;
43 dest.reserve(src.size());
45 for(
unsigned i=0; i<src.size(); i++)
47 T ch=(
unsigned char)src[i];
53 INVARIANT(i < src.size(),
"backslash can't be last character");
55 ch=(
unsigned char)src[i];
58 case '\\': dest.push_back(ch);
break;
59 case 'n': dest.push_back(
'\n');
break;
60 case 't': dest.push_back(
'\t');
break;
61 case 'v': dest.push_back(
'\v');
break;
62 case 'b': dest.push_back(
'\b');
break;
63 case 'r': dest.push_back(
'\r');
break;
64 case 'f': dest.push_back(
'\f');
break;
65 case 'a': dest.push_back(
'\a');
break;
66 case '"': dest.push_back(
'"');
break;
67 case '\'': dest.push_back(
'\'');
break;
76 const unsigned digits = (ch ==
'u') ? 4u : 8u;
79 for(
unsigned count=digits;
80 count!=0 && i<src.size();
100 while(i<src.size() &&
isxdigit(src[i]))
124 while(i<src.size() &&
isdigit(src[i]))
153 return unescape_string_templ<char>(src);
157 const std::string &src)
159 return unescape_string_templ<unsigned int>(src);
166 for(; digits!=0; digits--, hex++)
188 for(; digits!=0; digits--, octal++)
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
unsigned octal_to_unsigned(const char *octal, std::size_t digits)
std::string unescape_string(const std::string &src)
std::basic_string< T > unescape_string_templ(const std::string &src)
static void append_universal_char(unsigned int value, std::string &dest)
std::basic_string< unsigned int > unescape_wide_string(const std::string &src)
unsigned hex_to_unsigned(const char *hex, std::size_t digits)
ANSI-C Language Conversion.
std::string utf32_native_endian_to_utf8(const std::basic_string< unsigned int > &s)