| 1133 | } // namespace |
| 1134 | |
| 1135 | StringValue StringValue::Quote(google::protobuf::Arena* absl_nonnull arena) const { |
| 1136 | return value_.Visit(absl::Overload( |
| 1137 | [&](absl::string_view rep) -> StringValue { |
| 1138 | std::string result; |
| 1139 | result.push_back('\"'); |
| 1140 | while (!rep.empty()) { |
| 1141 | char32_t code_point; |
| 1142 | size_t code_units; |
| 1143 | std::tie(code_point, code_units) = cel::internal::Utf8Decode(rep); |
| 1144 | AppendQuoteCodePoint(code_point, result); |
| 1145 | rep.remove_prefix(code_units); |
| 1146 | } |
| 1147 | result.push_back('\"'); |
| 1148 | return StringValue::From(std::move(result), arena); |
| 1149 | }, |
| 1150 | [&](const absl::Cord& rep) -> StringValue { |
| 1151 | absl::Cord::CharIterator begin = rep.char_begin(); |
| 1152 | absl::Cord::CharIterator end = rep.char_end(); |
| 1153 | std::string result; |
| 1154 | result.push_back('\"'); |
| 1155 | while (begin != end) { |
| 1156 | char32_t code_point; |
| 1157 | size_t code_units; |
| 1158 | std::tie(code_point, code_units) = cel::internal::Utf8Decode(begin); |
| 1159 | AppendQuoteCodePoint(code_point, result); |
| 1160 | absl::Cord::Advance(&begin, code_units); |
| 1161 | } |
| 1162 | result.push_back('\"'); |
| 1163 | return StringValue::From(std::move(result), arena); |
| 1164 | })); |
| 1165 | } |
| 1166 | |
| 1167 | StringValue StringValue::Reverse(google::protobuf::Arena* absl_nonnull arena) const { |
| 1168 | return value_.Visit(absl::Overload( |
no test coverage detected