OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_SPDY_PLATFORM_IMPL_SPDY_STRING_UTILS_IMPL_H_ | 5 #ifndef NET_SPDY_PLATFORM_IMPL_SPDY_STRING_UTILS_IMPL_H_ |
6 #define NET_SPDY_PLATFORM_IMPL_SPDY_STRING_UTILS_IMPL_H_ | 6 #define NET_SPDY_PLATFORM_IMPL_SPDY_STRING_UTILS_IMPL_H_ |
7 | 7 |
8 #include <sstream> | 8 #include <sstream> |
9 #include <string> | |
10 | 9 |
11 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
12 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "net/spdy/platform/api/spdy_string.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 template <typename... Args> | 16 template <typename... Args> |
17 inline std::string SpdyStrCatImpl(const Args&... args) { | 17 inline SpdyString SpdyStrCatImpl(const Args&... args) { |
18 std::ostringstream oss; | 18 std::ostringstream oss; |
19 int dummy[] = {1, (oss << args, 0)...}; | 19 int dummy[] = {1, (oss << args, 0)...}; |
20 static_cast<void>(dummy); | 20 static_cast<void>(dummy); |
21 return oss.str(); | 21 return oss.str(); |
22 } | 22 } |
23 | 23 |
24 template <typename... Args> | 24 template <typename... Args> |
25 inline void SpdyStrAppendImpl(std::string* output, Args... args) { | 25 inline void SpdyStrAppendImpl(SpdyString* output, Args... args) { |
26 output->append(SpdyStrCatImpl(args...)); | 26 output->append(SpdyStrCatImpl(args...)); |
27 } | 27 } |
28 | 28 |
29 template <typename... Args> | 29 template <typename... Args> |
30 inline std::string SpdyStringPrintfImpl(const Args&... args) { | 30 inline SpdyString SpdyStringPrintfImpl(const Args&... args) { |
31 return base::StringPrintf(std::forward<const Args&>(args)...); | 31 return base::StringPrintf(std::forward<const Args&>(args)...); |
32 } | 32 } |
33 | 33 |
34 template <typename... Args> | 34 template <typename... Args> |
35 inline void SpdyStringAppendFImpl(const Args&... args) { | 35 inline void SpdyStringAppendFImpl(const Args&... args) { |
36 base::StringAppendF(std::forward<const Args&>(args)...); | 36 base::StringAppendF(std::forward<const Args&>(args)...); |
37 } | 37 } |
38 | 38 |
39 inline char SpdyHexDigitToIntImpl(char c) { | 39 inline char SpdyHexDigitToIntImpl(char c) { |
40 return base::HexDigitToInt(c); | 40 return base::HexDigitToInt(c); |
41 } | 41 } |
42 | 42 |
43 } // namespace net | 43 } // namespace net |
44 | 44 |
45 #endif // NET_SPDY_PLATFORM_IMPL_SPDY_STRING_UTILS_IMPL_H_ | 45 #endif // NET_SPDY_PLATFORM_IMPL_SPDY_STRING_UTILS_IMPL_H_ |
OLD | NEW |