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 | |
bnc | 4790400 | 2019-08-16 11:49:48 -0700 | [diff] [blame] | 8 | #include <string> |
QUICHE team | fd50a40 | 2018-12-07 22:54:05 -0500 | [diff] [blame] | 9 | #include <type_traits> |
| 10 | #include <utility> |
| 11 | |
QUICHE team | fd50a40 | 2018-12-07 22:54:05 -0500 | [diff] [blame] | 12 | #include "net/http2/platform/impl/http2_string_utils_impl.h" |
bnc | 74646d1 | 2019-12-13 09:21:19 -0800 | [diff] [blame] | 13 | #include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" |
QUICHE team | fd50a40 | 2018-12-07 22:54:05 -0500 | [diff] [blame] | 14 | |
| 15 | namespace http2 { |
| 16 | |
| 17 | template <typename... Args> |
bnc | 4790400 | 2019-08-16 11:49:48 -0700 | [diff] [blame] | 18 | inline void Http2StrAppend(std::string* output, const Args&... args) { |
QUICHE team | fd50a40 | 2018-12-07 22:54:05 -0500 | [diff] [blame] | 19 | Http2StrAppendImpl(output, std::forward<const Args&>(args)...); |
| 20 | } |
| 21 | |
| 22 | template <typename... Args> |
bnc | 4790400 | 2019-08-16 11:49:48 -0700 | [diff] [blame] | 23 | inline std::string Http2StringPrintf(const Args&... args) { |
QUICHE team | fd50a40 | 2018-12-07 22:54:05 -0500 | [diff] [blame] | 24 | return Http2StringPrintfImpl(std::forward<const Args&>(args)...); |
| 25 | } |
| 26 | |
bnc | 4790400 | 2019-08-16 11:49:48 -0700 | [diff] [blame] | 27 | inline std::string Http2HexEncode(const void* bytes, size_t size) { |
QUICHE team | fd50a40 | 2018-12-07 22:54:05 -0500 | [diff] [blame] | 28 | return Http2HexEncodeImpl(bytes, size); |
| 29 | } |
| 30 | |
bnc | 74646d1 | 2019-12-13 09:21:19 -0800 | [diff] [blame] | 31 | inline std::string Http2HexDecode(quiche::QuicheStringPiece data) { |
QUICHE team | fd50a40 | 2018-12-07 22:54:05 -0500 | [diff] [blame] | 32 | return Http2HexDecodeImpl(data); |
| 33 | } |
| 34 | |
bnc | 74646d1 | 2019-12-13 09:21:19 -0800 | [diff] [blame] | 35 | inline std::string Http2HexDump(quiche::QuicheStringPiece data) { |
QUICHE team | fd50a40 | 2018-12-07 22:54:05 -0500 | [diff] [blame] | 36 | return Http2HexDumpImpl(data); |
| 37 | } |
| 38 | |
bnc | 74646d1 | 2019-12-13 09:21:19 -0800 | [diff] [blame] | 39 | inline std::string Http2HexEscape(quiche::QuicheStringPiece data) { |
QUICHE team | fd50a40 | 2018-12-07 22:54:05 -0500 | [diff] [blame] | 40 | return Http2HexEscapeImpl(data); |
| 41 | } |
| 42 | |
| 43 | template <typename Number> |
bnc | 4790400 | 2019-08-16 11:49:48 -0700 | [diff] [blame] | 44 | inline std::string Http2Hex(Number number) { |
QUICHE team | fd50a40 | 2018-12-07 22:54:05 -0500 | [diff] [blame] | 45 | static_assert(std::is_integral<Number>::value, "Number has to be an int"); |
| 46 | return Http2HexImpl(number); |
| 47 | } |
| 48 | |
| 49 | } // namespace http2 |
| 50 | |
| 51 | #endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_STRING_UTILS_H_ |