QUICHE team | 82dee2f | 2019-01-18 12:35:12 -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_SPDY_PLATFORM_API_SPDY_STRING_UTILS_H_ |
| 6 | #define QUICHE_SPDY_PLATFORM_API_SPDY_STRING_UTILS_H_ |
| 7 | |
bnc | 4471291 | 2019-08-15 18:58:14 -0700 | [diff] [blame] | 8 | #include <string> |
QUICHE team | 82dee2f | 2019-01-18 12:35:12 -0500 | [diff] [blame] | 9 | #include <utility> |
| 10 | |
| 11 | // The following header file has to be included from at least |
| 12 | // non-test file in order to avoid strange linking errors. |
| 13 | // TODO(bnc): Remove this include as soon as it is included elsewhere in |
| 14 | // non-test code. |
| 15 | #include "net/third_party/quiche/src/spdy/platform/api/spdy_mem_slice.h" |
| 16 | |
bnc | 7f82d04 | 2020-01-03 12:18:53 -0800 | [diff] [blame] | 17 | #include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" |
QUICHE team | 82dee2f | 2019-01-18 12:35:12 -0500 | [diff] [blame] | 18 | #include "net/spdy/platform/impl/spdy_string_utils_impl.h" |
| 19 | |
| 20 | namespace spdy { |
| 21 | |
| 22 | template <typename... Args> |
bnc | 4471291 | 2019-08-15 18:58:14 -0700 | [diff] [blame] | 23 | inline void SpdyStrAppend(std::string* output, const Args&... args) { |
QUICHE team | 82dee2f | 2019-01-18 12:35:12 -0500 | [diff] [blame] | 24 | SpdyStrAppendImpl(output, std::forward<const Args&>(args)...); |
| 25 | } |
| 26 | |
| 27 | inline char SpdyHexDigitToInt(char c) { |
| 28 | return SpdyHexDigitToIntImpl(c); |
| 29 | } |
| 30 | |
bnc | 7f82d04 | 2020-01-03 12:18:53 -0800 | [diff] [blame] | 31 | inline std::string SpdyHexDecode(quiche::QuicheStringPiece data) { |
QUICHE team | 82dee2f | 2019-01-18 12:35:12 -0500 | [diff] [blame] | 32 | return SpdyHexDecodeImpl(data); |
| 33 | } |
| 34 | |
bnc | 7f82d04 | 2020-01-03 12:18:53 -0800 | [diff] [blame] | 35 | inline bool SpdyHexDecodeToUInt32(quiche::QuicheStringPiece data, |
| 36 | uint32_t* out) { |
QUICHE team | 82dee2f | 2019-01-18 12:35:12 -0500 | [diff] [blame] | 37 | return SpdyHexDecodeToUInt32Impl(data, out); |
| 38 | } |
| 39 | |
bnc | 4471291 | 2019-08-15 18:58:14 -0700 | [diff] [blame] | 40 | inline std::string SpdyHexEncode(const char* bytes, size_t size) { |
QUICHE team | 82dee2f | 2019-01-18 12:35:12 -0500 | [diff] [blame] | 41 | return SpdyHexEncodeImpl(bytes, size); |
| 42 | } |
| 43 | |
bnc | 4471291 | 2019-08-15 18:58:14 -0700 | [diff] [blame] | 44 | inline std::string SpdyHexEncodeUInt32AndTrim(uint32_t data) { |
QUICHE team | 82dee2f | 2019-01-18 12:35:12 -0500 | [diff] [blame] | 45 | return SpdyHexEncodeUInt32AndTrimImpl(data); |
| 46 | } |
| 47 | |
bnc | 7f82d04 | 2020-01-03 12:18:53 -0800 | [diff] [blame] | 48 | inline std::string SpdyHexDump(quiche::QuicheStringPiece data) { |
QUICHE team | 82dee2f | 2019-01-18 12:35:12 -0500 | [diff] [blame] | 49 | return SpdyHexDumpImpl(data); |
| 50 | } |
| 51 | |
QUICHE team | 1378a94 | 2020-01-03 08:18:14 -0800 | [diff] [blame] | 52 | using SpdyStringPieceCaseHash = SpdyStringPieceCaseHashImpl; |
| 53 | |
| 54 | using SpdyStringPieceCaseEq = SpdyStringPieceCaseEqImpl; |
| 55 | |
QUICHE team | 82dee2f | 2019-01-18 12:35:12 -0500 | [diff] [blame] | 56 | } // namespace spdy |
| 57 | |
| 58 | #endif // QUICHE_SPDY_PLATFORM_API_SPDY_STRING_UTILS_H_ |