This function returns the empty string if you try to read something that is not a string or key.
| 519 | // This function returns the empty string if you try to read something that |
| 520 | // is not a string or key. |
| 521 | String AsString() const { |
| 522 | if (type_ == FBT_STRING) { |
| 523 | return String(Indirect(), byte_width_); |
| 524 | } else if (type_ == FBT_KEY) { |
| 525 | auto key = Indirect(); |
| 526 | return String(key, byte_width_, |
| 527 | strlen(reinterpret_cast<const char *>(key))); |
| 528 | } else { |
| 529 | return String::EmptyString(); |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | // Unlike AsString(), this will convert any type to a std::string. |
| 534 | std::string ToString() const { |