blob: f14d93ae87f67eae7d3b0cba95519a034d6ff51c [file] [log] [blame]
QUICHE teamfd50a402018-12-07 22:54:05 -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_HTTP2_PLATFORM_API_HTTP2_STRING_UTILS_H_
6#define QUICHE_HTTP2_PLATFORM_API_HTTP2_STRING_UTILS_H_
7
bnc47904002019-08-16 11:49:48 -07008#include <string>
QUICHE teamfd50a402018-12-07 22:54:05 -05009#include <type_traits>
10#include <utility>
11
QUICHE teamfd50a402018-12-07 22:54:05 -050012#include "net/http2/platform/impl/http2_string_utils_impl.h"
bnc74646d12019-12-13 09:21:19 -080013#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
QUICHE teamfd50a402018-12-07 22:54:05 -050014
15namespace http2 {
16
17template <typename... Args>
bnc47904002019-08-16 11:49:48 -070018inline void Http2StrAppend(std::string* output, const Args&... args) {
QUICHE teamfd50a402018-12-07 22:54:05 -050019 Http2StrAppendImpl(output, std::forward<const Args&>(args)...);
20}
21
22template <typename... Args>
bnc47904002019-08-16 11:49:48 -070023inline std::string Http2StringPrintf(const Args&... args) {
QUICHE teamfd50a402018-12-07 22:54:05 -050024 return Http2StringPrintfImpl(std::forward<const Args&>(args)...);
25}
26
bnc47904002019-08-16 11:49:48 -070027inline std::string Http2HexEncode(const void* bytes, size_t size) {
QUICHE teamfd50a402018-12-07 22:54:05 -050028 return Http2HexEncodeImpl(bytes, size);
29}
30
bnc74646d12019-12-13 09:21:19 -080031inline std::string Http2HexDecode(quiche::QuicheStringPiece data) {
QUICHE teamfd50a402018-12-07 22:54:05 -050032 return Http2HexDecodeImpl(data);
33}
34
bnc74646d12019-12-13 09:21:19 -080035inline std::string Http2HexDump(quiche::QuicheStringPiece data) {
QUICHE teamfd50a402018-12-07 22:54:05 -050036 return Http2HexDumpImpl(data);
37}
38
bnc74646d12019-12-13 09:21:19 -080039inline std::string Http2HexEscape(quiche::QuicheStringPiece data) {
QUICHE teamfd50a402018-12-07 22:54:05 -050040 return Http2HexEscapeImpl(data);
41}
42
43template <typename Number>
bnc47904002019-08-16 11:49:48 -070044inline std::string Http2Hex(Number number) {
QUICHE teamfd50a402018-12-07 22:54:05 -050045 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_