* @brief Converts the given character into a hexadecimal representation to be * used in escaped C strings. * * @param[in] c Character to be converted. * @param[in] charSize How large is actually the character in @a c (in bits)? * * For example, @c ';' is converted into @c "\x3b" when @c charSize is 8. */
| 138 | * For example, @c ';' is converted into @c "\x3b" when @c charSize is 8. |
| 139 | */ |
| 140 | std::string charToHexaStringRepr(WideCharType c, std::size_t charSize) { |
| 141 | std::stringstream stringRepr; |
| 142 | stringRepr << "\\x" |
| 143 | << std::setfill('0') << std::setw(widthOf(charSize)) |
| 144 | << std::hex << c; |
| 145 | return stringRepr.str(); |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * @brief Can the given character be appended literally, i.e. without escaping |
no test coverage detected