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 8 #include <string> 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 17 #include "absl/strings/string_view.h" 18 #include "net/spdy/platform/impl/spdy_string_utils_impl.h" 19 20 namespace spdy { 21 22 template <typename... Args> SpdyStrAppend(std::string * output,const Args &...args)23inline void SpdyStrAppend(std::string* output, const Args&... args) { 24 SpdyStrAppendImpl(output, std::forward<const Args&>(args)...); 25 } 26 SpdyHexDigitToInt(char c)27inline char SpdyHexDigitToInt(char c) { 28 return SpdyHexDigitToIntImpl(c); 29 } 30 SpdyHexDecode(absl::string_view data)31inline std::string SpdyHexDecode(absl::string_view data) { 32 return SpdyHexDecodeImpl(data); 33 } 34 SpdyHexDecodeToUInt32(absl::string_view data,uint32_t * out)35inline bool SpdyHexDecodeToUInt32(absl::string_view data, uint32_t* out) { 36 return SpdyHexDecodeToUInt32Impl(data, out); 37 } 38 SpdyHexEncode(const char * bytes,size_t size)39inline std::string SpdyHexEncode(const char* bytes, size_t size) { 40 return SpdyHexEncodeImpl(bytes, size); 41 } 42 SpdyHexEncodeUInt32AndTrim(uint32_t data)43inline std::string SpdyHexEncodeUInt32AndTrim(uint32_t data) { 44 return SpdyHexEncodeUInt32AndTrimImpl(data); 45 } 46 SpdyHexDump(absl::string_view data)47inline std::string SpdyHexDump(absl::string_view data) { 48 return SpdyHexDumpImpl(data); 49 } 50 51 using SpdyStringPieceCaseHash = SpdyStringPieceCaseHashImpl; 52 53 using SpdyStringPieceCaseEq = SpdyStringPieceCaseEqImpl; 54 55 } // namespace spdy 56 57 #endif // QUICHE_SPDY_PLATFORM_API_SPDY_STRING_UTILS_H_ 58