MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / Quote

Method Quote

common/values/string_value.cc:1135–1165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1133} // namespace
1134
1135StringValue 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
1167StringValue StringValue::Reverse(google::protobuf::Arena* absl_nonnull arena) const {
1168 return value_.Visit(absl::Overload(

Callers 1

QuoteFunction · 0.80

Calls 4

AppendQuoteCodePointFunction · 0.85
Utf8DecodeFunction · 0.50
VisitMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected