blob: b023f733e04de9621ce8a121c7c8bbff7ed5975b [file] [log] [blame]
QUICHE team82dee2f2019-01-18 12:35:12 -05001// 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
bnc44712912019-08-15 18:58:14 -07008#include <string>
QUICHE team82dee2f2019-01-18 12:35:12 -05009#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
bnc7f82d042020-01-03 12:18:53 -080017#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
QUICHE team82dee2f2019-01-18 12:35:12 -050018#include "net/spdy/platform/impl/spdy_string_utils_impl.h"
19
20namespace spdy {
21
22template <typename... Args>
bnc44712912019-08-15 18:58:14 -070023inline void SpdyStrAppend(std::string* output, const Args&... args) {
QUICHE team82dee2f2019-01-18 12:35:12 -050024 SpdyStrAppendImpl(output, std::forward<const Args&>(args)...);
25}
26
27inline char SpdyHexDigitToInt(char c) {
28 return SpdyHexDigitToIntImpl(c);
29}
30
bnc7f82d042020-01-03 12:18:53 -080031inline std::string SpdyHexDecode(quiche::QuicheStringPiece data) {
QUICHE team82dee2f2019-01-18 12:35:12 -050032 return SpdyHexDecodeImpl(data);
33}
34
bnc7f82d042020-01-03 12:18:53 -080035inline bool SpdyHexDecodeToUInt32(quiche::QuicheStringPiece data,
36 uint32_t* out) {
QUICHE team82dee2f2019-01-18 12:35:12 -050037 return SpdyHexDecodeToUInt32Impl(data, out);
38}
39
bnc44712912019-08-15 18:58:14 -070040inline std::string SpdyHexEncode(const char* bytes, size_t size) {
QUICHE team82dee2f2019-01-18 12:35:12 -050041 return SpdyHexEncodeImpl(bytes, size);
42}
43
bnc44712912019-08-15 18:58:14 -070044inline std::string SpdyHexEncodeUInt32AndTrim(uint32_t data) {
QUICHE team82dee2f2019-01-18 12:35:12 -050045 return SpdyHexEncodeUInt32AndTrimImpl(data);
46}
47
bnc7f82d042020-01-03 12:18:53 -080048inline std::string SpdyHexDump(quiche::QuicheStringPiece data) {
QUICHE team82dee2f2019-01-18 12:35:12 -050049 return SpdyHexDumpImpl(data);
50}
51
QUICHE team1378a942020-01-03 08:18:14 -080052using SpdyStringPieceCaseHash = SpdyStringPieceCaseHashImpl;
53
54using SpdyStringPieceCaseEq = SpdyStringPieceCaseEqImpl;
55
QUICHE team82dee2f2019-01-18 12:35:12 -050056} // namespace spdy
57
58#endif // QUICHE_SPDY_PLATFORM_API_SPDY_STRING_UTILS_H_