return false;
}
-}
+} // namespace detail
//////////////////////////////////////////////////////////////////////
output);
}
-template <class String1, class String2>
-void backslashify(const String1& input, String2& output, bool hex_style) {
+template <class OutputString>
+void backslashify(
+ folly::StringPiece input,
+ OutputString& output,
+ bool hex_style) {
static const char hexValues[] = "0123456789abcdef";
output.clear();
output.reserve(3 * input.size());
if (hex_style) {
hex_append = true;
} else {
- if (c == '\r') output += 'r';
- else if (c == '\n') output += 'n';
- else if (c == '\t') output += 't';
- else if (c == '\a') output += 'a';
- else if (c == '\b') output += 'b';
- else if (c == '\0') output += '0';
- else if (c == '\\') output += '\\';
- else {
+ if (c == '\r') {
+ output += 'r';
+ } else if (c == '\n') {
+ output += 'n';
+ } else if (c == '\t') {
+ output += 't';
+ } else if (c == '\a') {
+ output += 'a';
+ } else if (c == '\b') {
+ output += 'b';
+ } else if (c == '\0') {
+ output += '0';
+ } else if (c == '\\') {
+ output += '\\';
+ } else {
hex_append = true;
}
}
template <class InputString, class OutputString>
bool hexlify(const InputString& input, OutputString& output,
bool append_output) {
- if (!append_output) output.clear();
+ if (!append_output) {
+ output.clear();
+ }
static char hexValues[] = "0123456789abcdef";
auto j = output.size();