| 426 | } |
| 427 | |
| 428 | Tuple::UserTypeStr Tuple::getUserType(size_t index) const { |
| 429 | // Valid index. |
| 430 | if (index >= offsets.size()) { |
| 431 | throw invalid_tuple_index(); |
| 432 | } |
| 433 | |
| 434 | // Valid user type code. |
| 435 | ASSERT_LT(offsets[index], data.size()); |
| 436 | uint8_t code = data[offsets[index]]; |
| 437 | if (!isUserType(code)) { |
| 438 | throw invalid_tuple_data_type(); |
| 439 | } |
| 440 | |
| 441 | size_t start = offsets[index] + 1; |
| 442 | |
| 443 | Standalone<StringRef> str; |
| 444 | VectorRef<uint8_t> staging; |
| 445 | staging.append(str.arena(), data.begin() + start, data.size() - start); |
| 446 | str.StringRef::operator=(StringRef(staging.begin(), staging.size())); |
| 447 | |
| 448 | return Tuple::UserTypeStr(code, str); |
| 449 | } |
| 450 | |
| 451 | KeyRange Tuple::range(Tuple const& tuple) const { |
| 452 | VectorRef<uint8_t> begin; |
no test coverage detected