QUICHE team | fd50a40 | 2018-12-07 22:54:05 -0500 | [diff] [blame] | 1 | // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_STRING_UTILS_H_ |
| 6 | #define QUICHE_HTTP2_PLATFORM_API_HTTP2_STRING_UTILS_H_ |
| 7 | |
| 8 | #include <type_traits> |
| 9 | #include <utility> |
| 10 | |
| 11 | #include "net/third_party/quiche/src/http2/platform/api/http2_string.h" |
| 12 | #include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h" |
| 13 | #include "net/http2/platform/impl/http2_string_utils_impl.h" |
| 14 | |
| 15 | namespace http2 { |
| 16 | |
| 17 | template <typename... Args> |
| 18 | inline Http2String Http2StrCat(const Args&... args) { |
| 19 | return Http2StrCatImpl(std::forward<const Args&>(args)...); |
| 20 | } |
| 21 | |
| 22 | template <typename... Args> |
| 23 | inline void Http2StrAppend(Http2String* output, const Args&... args) { |
| 24 | Http2StrAppendImpl(output, std::forward<const Args&>(args)...); |
| 25 | } |
| 26 | |
| 27 | template <typename... Args> |
| 28 | inline Http2String Http2StringPrintf(const Args&... args) { |
| 29 | return Http2StringPrintfImpl(std::forward<const Args&>(args)...); |
| 30 | } |
| 31 | |
| 32 | inline Http2String Http2HexEncode(const void* bytes, size_t size) { |
| 33 | return Http2HexEncodeImpl(bytes, size); |
| 34 | } |
| 35 | |
| 36 | inline Http2String Http2HexDecode(Http2StringPiece data) { |
| 37 | return Http2HexDecodeImpl(data); |
| 38 | } |
| 39 | |
| 40 | inline Http2String Http2HexDump(Http2StringPiece data) { |
| 41 | return Http2HexDumpImpl(data); |
| 42 | } |
| 43 | |
| 44 | inline Http2String Http2HexEscape(Http2StringPiece data) { |
| 45 | return Http2HexEscapeImpl(data); |
| 46 | } |
| 47 | |
| 48 | template <typename Number> |
| 49 | inline Http2String Http2Hex(Number number) { |
| 50 | static_assert(std::is_integral<Number>::value, "Number has to be an int"); |
| 51 | return Http2HexImpl(number); |
| 52 | } |
| 53 | |
| 54 | } // namespace http2 |
| 55 | |
| 56 | #endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_STRING_UTILS_H_ |