Look up a string-typed metadata entry on a grid.
- Parameters
-
| index | Grid index, less than read_grid_count(). |
| key | Metadata key, such as "class" or "vector_type". |
- Returns
- The value, or empty if absent, not a string, or index is out of range.
Definition at line 713 of file VDBArchive.cpp.
714{
716 return {};
717 }
718
719 const tvdb_grid_t& grid =
m_state->read_file.grids[
index];
720
721 for (size_t i = 0; i < grid.metadata.count; ++i) {
722 const tvdb_meta_entry_t& entry = grid.metadata.entries[i];
723 if (!entry.name || key != entry.name) {
724 continue;
725 }
726 if (entry.value.type != TVDB_VALUE_STRING || !entry.value.u.s.str) {
727 return {};
728 }
729 return { entry.value.u.s.str, entry.value.u.s.len };
730 }
731 return {};
732}
std::unique_ptr< State > m_state
References index, and m_state.