| 207 | |
| 208 | template <class FieldType, size_t NameLen> |
| 209 | void appendField(fmt::memory_buffer& b, char const (&name)[NameLen], Optional<FieldType> const& field) { |
| 210 | if (!field.present()) |
| 211 | return; |
| 212 | auto const& f = field.get(); |
| 213 | auto bi = std::back_inserter(b); |
| 214 | if constexpr (std::is_same_v<FieldType, VectorRef<StringRef>>) { |
| 215 | fmt::format_to(bi, " {}=[", name); |
| 216 | for (auto i = 0; i < f.size(); i++) { |
| 217 | if (i) |
| 218 | fmt::format_to(bi, ","); |
| 219 | fmt::format_to(bi, f[i].toStringView()); |
| 220 | } |
| 221 | fmt::format_to(bi, "]"); |
| 222 | } else if constexpr (std::is_same_v<FieldType, StringRef>) { |
| 223 | fmt::format_to(bi, " {}={}", name, f.toStringView()); |
| 224 | } else { |
| 225 | fmt::format_to(bi, " {}={}", name, f); |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | StringRef TokenRef::toStringRef(Arena& arena) { |
| 230 | auto buf = fmt::memory_buffer(); |
no test coverage detected