| 496 | } |
| 497 | |
| 498 | void ByteString::CopyToString(std::string* absl_nonnull out) const { |
| 499 | ABSL_DCHECK(out != nullptr); |
| 500 | |
| 501 | switch (GetKind()) { |
| 502 | case ByteStringKind::kSmall: |
| 503 | out->assign(GetSmall()); |
| 504 | break; |
| 505 | case ByteStringKind::kMedium: |
| 506 | out->assign(GetMedium()); |
| 507 | break; |
| 508 | case ByteStringKind::kLarge: |
| 509 | absl::CopyCordToString(GetLarge(), out); |
| 510 | break; |
| 511 | } |
| 512 | } |
| 513 | |
| 514 | void ByteString::AppendToString(std::string* absl_nonnull out) const { |
| 515 | ABSL_DCHECK(out != nullptr); |