11#if defined(ARCADIA_ROOT)
12#include <google/protobuf/port.h>
15USERVER_NAMESPACE_BEGIN
19#if defined(ARCADIA_ROOT)
21using ProtoStringType = TProtoStringType;
24using ProtoStringType = std::string;
29template <
typename TStringLike>
30concept StringLike =
requires(
const TStringLike& str) {
36template <StringLike TStringLike>
37[[nodiscard]]
inline std::string_view ToStringView(
const TStringLike& str) {
38 return {str.data(), str.size()};
42template <StringLike TStringLike>
43[[nodiscard]]
inline decltype(
auto) ToString(
const TStringLike& str) {
44 if constexpr (std::is_same_v<std::decay_t<TStringLike>, std::string>) {
47 return std::string{str.data(), str.size()};
52[[nodiscard]]
inline std::string ToString(std::string&& str) {
return std::move(str); }
57template <
typename TProtoString = ProtoStringType>
58[[nodiscard]]
inline decltype(
auto) ToProtoString(
const std::string& str) {
59 if constexpr (std::is_same_v<TProtoString, std::string>) {
62 return TProtoString{str.data(), str.size()};
69template <
typename TProtoString = ProtoStringType>
70[[nodiscard]]
inline TProtoString ToProtoString(std::string&& str) {
71 if constexpr (std::is_same_v<TProtoString, std::string>) {
72 return std::move(str);
74 return TProtoString{std::move(str)};